"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/siprec/siprec_logic.c" between
opensips-3.2.0-rc1.tar.gz and opensips-3.2.0.tar.gz

About: OpenSIPS is a multi-functional, multi-purpose signaling SIP Server (Session Initiation Protocol). It can act as SIP Router/Switch, SIP Registrar, Application Server, Redirect Server, Load Balancer / Dispatcher, Back-to-Back User Agent, Presence Server, IM Server, Session Border Controller, SIP Front-End, NAT traversal Server, IP Gateway (SMS, XMPP) and others.

siprec_logic.c  (opensips-3.2.0-rc1):siprec_logic.c  (opensips-3.2.0)
skipping to change at line 197 skipping to change at line 197
/* store the session in the dialog */ /* store the session in the dialog */
if (srec_dlg.register_dlgcb(sess->dlg, DLGCB_WRITE_VP, if (srec_dlg.register_dlgcb(sess->dlg, DLGCB_WRITE_VP,
srec_dlg_write_callback, sess, NULL)) srec_dlg_write_callback, sess, NULL))
LM_WARN("cannot register callback for session serialization! " LM_WARN("cannot register callback for session serialization! "
"Will not be able to end siprec session in case of a rest art!\n"); "Will not be able to end siprec session in case of a rest art!\n");
sess->flags |= SIPREC_DLG_CBS; sess->flags |= SIPREC_DLG_CBS;
return 0; return 0;
} }
static int srec_b2b_notify(struct sip_msg *msg, str *key, int type, void *param) static int srec_b2b_notify(struct sip_msg *msg, str *key, int type, void *param,
int flags)
{ {
struct b2b_req_data req; struct b2b_req_data req;
struct src_sess *ss; struct src_sess *ss;
int ret = -1; int ret = -1;
str ack = str_init(ACK); str ack = str_init(ACK);
str bye = str_init(BYE); str bye = str_init(BYE);
/* for now we only receive replies from SRS */ /* for now we only receive replies from SRS */
if (type != B2B_REPLY) if (type != B2B_REPLY)
return -1; return -1;
skipping to change at line 350 skipping to change at line 351
memcpy(ss->b2b_callid.s, info->callid.s, ss->b2b_callid.len); memcpy(ss->b2b_callid.s, info->callid.s, ss->b2b_callid.len);
return 0; return 0;
} }
static int srs_send_invite(struct src_sess *sess) static int srs_send_invite(struct src_sess *sess)
{ {
client_info_t ci; client_info_t ci;
str param, body; str param, body;
str *client; str *client;
str hdrs; str hdrs;
str ct, contact;
static str extra_headers = str_init( static str extra_headers = str_init(
"Require: siprec" CRLF "Require: siprec" CRLF
"Content-Type: multipart/mixed;boundary=" OSS_BOUNDARY CR LF "Content-Type: multipart/mixed;boundary=" OSS_BOUNDARY CR LF
); );
memset(&ci, 0, sizeof ci); memset(&ci, 0, sizeof ci);
ci.method.s = INVITE; ci.method.s = INVITE;
ci.method.len = INVITE_LEN; ci.method.len = INVITE_LEN;
/* try the first srs_uri */ /* try the first srs_uri */
skipping to change at line 380 skipping to change at line 382
memcpy(hdrs.s, sess->headers.s, sess->headers.len); memcpy(hdrs.s, sess->headers.s, sess->headers.len);
hdrs.len = sess->headers.len; hdrs.len = sess->headers.len;
memcpy(hdrs.s + hdrs.len, extra_headers.s, extra_headers. len); memcpy(hdrs.s + hdrs.len, extra_headers.s, extra_headers. len);
hdrs.len += extra_headers.len; hdrs.len += extra_headers.len;
ci.extra_headers = &hdrs; ci.extra_headers = &hdrs;
} }
} else } else
ci.extra_headers = &extra_headers; ci.extra_headers = &extra_headers;
ci.send_sock = sess->socket; ci.send_sock = sess->socket;
ci.local_contact.s = contact_builder(sess->socket, &ci.local_contact.len) ; ct.s = contact_builder(sess->socket, &ct.len);
if (srs_build_body(sess, &body, SRS_BOTH) < 0) { if (srs_build_body(sess, &body, SRS_BOTH) < 0) {
LM_ERR("cannot generate request body!\n"); LM_ERR("cannot generate request body!\n");
return -2; return -2;
} }
ci.body = &body; ci.body = &body;
contact.len = 1 /* < */ + ct.len + 10 /* >;+sip.src */;
contact.s = pkg_malloc(contact.len);
if (contact.s) {
contact.s[0] = '<';
memcpy(contact.s + 1, ct.s, ct.len);
memcpy(contact.s + 1 + ct.len, ">;+sip.src", 10);
ci.local_contact = contact;
} else {
LM_ERR("could not alloc buffer for adding contact param - sending
without param!\n");
ci.local_contact = ct;
}
/* XXX: hack to pass a parameter :( */ /* XXX: hack to pass a parameter :( */
param.s = (char *)&sess; param.s = (char *)&sess;
param.len = sizeof(void *); param.len = sizeof(void *);
client = srec_b2b.client_new(&ci, srec_b2b_notify, srec_b2b_confirm, client = srec_b2b.client_new(&ci, srec_b2b_notify, srec_b2b_confirm,
&mod_name, (str *)&param, NULL); &mod_name, (str *)&param, NULL);
pkg_free(body.s);
if (contact.s)
pkg_free(contact.s);
if (ci.extra_headers != &extra_headers)
pkg_free(ci.extra_headers->s);
if (!client) { if (!client) {
LM_ERR("cannot start recording with %.*s!\n", LM_ERR("cannot start recording with %.*s!\n",
ci.req_uri.len, ci.req_uri.s); ci.req_uri.len, ci.req_uri.s);
pkg_free(body.s);
if (ci.extra_headers != &extra_headers)
pkg_free(ci.extra_headers->s);
return -1; return -1;
} }
/* release generated body */
pkg_free(body.s);
if (ci.extra_headers != &extra_headers)
pkg_free(ci.extra_headers->s);
/* store the key in the param */ /* store the key in the param */
sess->b2b_key.s = shm_malloc(client->len); sess->b2b_key.s = shm_malloc(client->len);
if (!sess->b2b_key.s) { if (!sess->b2b_key.s) {
LM_ERR("out of shm memory!\n"); LM_ERR("out of shm memory!\n");
return -1; return -1;
} }
memcpy(sess->b2b_key.s, client->s, client->len); memcpy(sess->b2b_key.s, client->s, client->len);
sess->b2b_key.len = client->len; sess->b2b_key.len = client->len;
 End of changes. 7 change blocks. 
9 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)