Module: sip-router
Branch: master
Commit: 9a3aa5e6e7949dd08146910a301fbeebdf052742
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9a3aa5e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Jul 17 12:24:42 2013 +0200
tm: enhanced local request API to set send socket
---
modules/tm/uac.c | 19 +++++++++++++++++++
modules/tm/uac.h | 1 +
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/modules/tm/uac.c b/modules/tm/uac.c
index 38ead71..8f54dbe 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -701,6 +701,12 @@ int req_within(uac_req_t *uac_r)
goto err;
}
+ if(uac_r->ssock!=NULL && uac_r->ssock->len>0
+ && uac_r->dialog->send_sock==NULL) {
+ /* set local send socket */
+ uac_r->dialog->send_sock = lookup_local_socket(uac_r->ssock);
+ }
+
if ((uac_r->method->len == 3) && (!memcmp("ACK",
uac_r->method->s, 3))) goto send;
if ((uac_r->method->len == 6) && (!memcmp("CANCEL",
uac_r->method->s, 6))) goto send;
uac_r->dialog->loc_seq.value++; /* Increment CSeq */
@@ -741,6 +747,12 @@ int req_outside(uac_req_t *uac_r, str* ruri, str* to, str* from, str
*next_hop)
if (next_hop) uac_r->dialog->dst_uri = *next_hop;
w_calculate_hooks(uac_r->dialog);
+ if(uac_r->ssock!=NULL && uac_r->ssock->len>0
+ && uac_r->dialog->send_sock==NULL) {
+ /* set local send socket */
+ uac_r->dialog->send_sock = lookup_local_socket(uac_r->ssock);
+ }
+
return t_uac(uac_r);
err:
@@ -794,6 +806,13 @@ int request(uac_req_t *uac_r, str* ruri, str* to, str* from, str
*next_hop)
* before freeing dialog here must be removed
*/
uac_r->dialog = dialog;
+
+ if(uac_r->ssock!=NULL && uac_r->ssock->len>0
+ && uac_r->dialog->send_sock==NULL) {
+ /* set local send socket */
+ uac_r->dialog->send_sock = lookup_local_socket(uac_r->ssock);
+ }
+
res = t_uac(uac_r);
dialog->rem_target.s = 0;
dialog->dst_uri.s = 0;
diff --git a/modules/tm/uac.h b/modules/tm/uac.h
index 9843d15..b466426 100644
--- a/modules/tm/uac.h
+++ b/modules/tm/uac.h
@@ -54,6 +54,7 @@ typedef struct uac_req {
str *method;
str *headers;
str *body;
+ str *ssock;
dlg_t *dialog;
int cb_flags;
transaction_cb *cb;