summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-01-14 00:39:45 +0000
committerBenny Prijono <bennylp@teluu.com>2007-01-14 00:39:45 +0000
commit37ebd8262c2fded33381779df58351ba11c050de (patch)
tree2fc55477ce7f52492bf7d8de73bb1e5e99322805 /pjsip
parent2fe4e4e9985b9c4cbff7209a9c876a314abc9779 (diff)
Continuing work on ticket #50: make explicit transport selection works for sending response
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@882 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsip/sip_dialog.h4
-rw-r--r--pjsip/include/pjsip/sip_transaction.h8
-rw-r--r--pjsip/include/pjsip/sip_transport.h1
-rw-r--r--pjsip/src/pjsip/sip_dialog.c11
-rw-r--r--pjsip/src/pjsip/sip_transaction.c2
5 files changed, 17 insertions, 9 deletions
diff --git a/pjsip/include/pjsip/sip_dialog.h b/pjsip/include/pjsip/sip_dialog.h
index 9cea4ded..05a0d724 100644
--- a/pjsip/include/pjsip/sip_dialog.h
+++ b/pjsip/include/pjsip/sip_dialog.h
@@ -230,8 +230,8 @@ PJ_DECL(pj_status_t) pjsip_dlg_create_uas( pjsip_user_agent *ua,
/**
* Lock/bind dialog to a specific transport/listener. This is optional,
* as normally transport will be selected automatically based on the
- * destination of requests upon resolver completion. When the dialog is
- * explicitly bound to the specific transport/listener, all UAC transactions
+ * destination of messages upon resolver completion. When the dialog is
+ * explicitly bound to the specific transport/listener, all transactions
* originated by this dialog will use the specified transport/listener
* when sending outgoing requests.
*
diff --git a/pjsip/include/pjsip/sip_transaction.h b/pjsip/include/pjsip/sip_transaction.h
index dfd00339..0b5eee10 100644
--- a/pjsip/include/pjsip/sip_transaction.h
+++ b/pjsip/include/pjsip/sip_transaction.h
@@ -218,13 +218,9 @@ PJ_DECL(pj_status_t) pjsip_tsx_create_uas( pjsip_module *tsx_user,
/**
* Lock/bind transaction to a specific transport/listener. This is optional,
* as normally transport will be selected automatically based on the
- * destination of the request upon resolver completion. Also it's only valid
- * for UAC transaction (to send outgoing request), since for UAS the
- * transport will be selected according to rules about handling incoming
- * request (most likely it will use the transport where the request is
- * coming from if ";rport" parameter is present in Via header).
+ * destination of the message upon resolver completion.
*
- * @param tsx The UAC transaction.
+ * @param tsx The transaction.
* @param sel Transport selector containing the specification of
* transport or listener to be used by this transaction
* to send requests.
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h
index 1c82c385..d0e112f2 100644
--- a/pjsip/include/pjsip/sip_transport.h
+++ b/pjsip/include/pjsip/sip_transport.h
@@ -211,6 +211,7 @@ typedef struct pjsip_tpselector
union {
pjsip_transport *transport;
pjsip_tpfactory *listener;
+ void *ptr;
} u;
} pjsip_tpselector;
diff --git a/pjsip/src/pjsip/sip_dialog.c b/pjsip/src/pjsip/sip_dialog.c
index 7b97e5b8..7858f086 100644
--- a/pjsip/src/pjsip/sip_dialog.c
+++ b/pjsip/src/pjsip/sip_dialog.c
@@ -1325,6 +1325,17 @@ PJ_DEF(pj_status_t) pjsip_dlg_send_response( pjsip_dialog *dlg,
/* Must acquire dialog first, to prevent deadlock */
pjsip_dlg_inc_lock(dlg);
+ /* If the dialog is locked to transport, make sure that transaction
+ * is locked to the same transport too.
+ */
+ if (dlg->tp_sel.type != tsx->tp_sel.type ||
+ dlg->tp_sel.u.ptr != tsx->tp_sel.u.ptr)
+ {
+ status = pjsip_tsx_set_transport(tsx, &dlg->tp_sel);
+ pj_assert(status == PJ_SUCCESS);
+ }
+
+ /* Ask transaction to send the response */
status = pjsip_tsx_send_msg(tsx, tdata);
pjsip_dlg_dec_lock(dlg);
diff --git a/pjsip/src/pjsip/sip_transaction.c b/pjsip/src/pjsip/sip_transaction.c
index a0574ca4..4dc46520 100644
--- a/pjsip/src/pjsip/sip_transaction.c
+++ b/pjsip/src/pjsip/sip_transaction.c
@@ -1374,7 +1374,7 @@ PJ_DEF(pj_status_t) pjsip_tsx_set_transport(pjsip_transaction *tsx,
struct tsx_lock_data lck;
/* Must be UAC transaction */
- PJ_ASSERT_RETURN(tsx && sel && tsx->role == PJSIP_ROLE_UAC, PJ_EINVAL);
+ PJ_ASSERT_RETURN(tsx && sel, PJ_EINVAL);
/* Start locking the transaction. */
lock_tsx(tsx, &lck);