MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / rtpproxy_fill_call_args

Function rtpproxy_fill_call_args

modules/rtpproxy/rtpproxy.c:5129–5220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5127}
5128
5129static int rtpproxy_fill_call_args(struct rtp_relay_session *sess, struct rtpp_args *args,
5130 str *ip, str *type, str *in_iface, str *out_iface,
5131 str *global_flags, str *flags, str *extra_flags, int require_from_tag)
5132{
5133 char *p;
5134 str b;
5135
5136 if (!sess->from_tag) {
5137 if (require_from_tag &&
5138 (!sess->msg ||
5139 get_from_tag(sess->msg, &args->from_tag) == -1 ||
5140 args->from_tag.len == 0)) {
5141 LM_ERR("can't get From tag\n");
5142 return 0;
5143 }
5144 } else {
5145 args->from_tag = *sess->from_tag;
5146 }
5147 if (!sess->to_tag) {
5148 if (sess->msg && get_to_tag(sess->msg, &args->to_tag) == -1) {
5149 LM_ERR("can't get To tag\n");
5150 return 0;
5151 }
5152 } else {
5153 args->to_tag = *sess->to_tag;
5154 }
5155 if (!sess->callid) {
5156 if (!sess->msg ||
5157 get_callid(sess->msg, &args->callid) == -1 ||
5158 args->callid.len == 0) {
5159 LM_ERR("can't get Call-Id field\n");
5160 return 0;
5161 }
5162 } else {
5163 args->callid = *sess->callid;
5164 }
5165 if (sess->body)
5166 args->body = *sess->body;
5167
5168 p = pkg_malloc((type?type->len:0) + (in_iface?in_iface->len:0) +
5169 (out_iface?out_iface->len:0) + (global_flags?global_flags->len:0) +
5170 (flags?flags->len:0) + (extra_flags?extra_flags->len:0) + 1 +
5171 ((ip && ip->len)?ip->len + 1:0) +
5172 (sess->branch != -1?args->callid.len + 1 + INT2STR_MAX_LEN:0));
5173 if (!p) {
5174 LM_ERR("could not build flags!\n");
5175 return 0;
5176 }
5177 if (ip && ip->len) {
5178 args->arg2 = p;
5179 memcpy(p, ip->s, ip->len);
5180 p += ip->len;
5181 *p++ = '\0';
5182 }
5183 args->arg1 = p;
5184 if (type) {
5185 memcpy(p, type->s, type->len);
5186 p += type->len;

Callers 5

rtpproxy_api_offerFunction · 0.85
rtpproxy_api_answerFunction · 0.85
rtpproxy_api_deleteFunction · 0.85
rtpproxy_api_copy_answerFunction · 0.85
rtpproxy_api_copy_deleteFunction · 0.85

Calls 4

get_callidFunction · 0.85
int2strFunction · 0.85
get_from_tagFunction · 0.70
get_to_tagFunction · 0.70

Tested by

no test coverage detected