[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Sep 7 09:38:50 CDT 2010
branch "master" has been updated
via 58529157c6a31c4c708f28d84d76318bda4663e3 (commit)
from 0cc4395275aa7e551e5e51cca150c63639979e16 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit 58529157c6a31c4c708f28d84d76318bda4663e3
Author: Mark Michelson <mmichelson at digium.com>
Date: Tue Sep 7 09:33:43 2010 -0500
Use the from header user name as basis for finding endpoint.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 52d9ab7..e71f7dc 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -116,11 +116,20 @@ static void handle_new_invite(pjsip_rx_data *rdata)
SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
boost::shared_ptr<SipEndpointFactory> factory = dataModel.getEndpointFactory();
- //XXX Hardcoded "Butt" is bad for a lot of reasons,
- //but for now have it there just so stuff'll compile!
- //This should be looking up an endpoint instead of creating
- //one.
- SipEndpointPtr* caller = new SipEndpointPtr(factory->findByName("Butt"));
+ pjsip_uri *from = rdata->msg_info.from->uri;
+ std::string callerName("");
+ if (PJSIP_URI_SCHEME_IS_SIP(from) || PJSIP_URI_SCHEME_IS_SIPS(from))
+ {
+ pjsip_sip_uri *sipFrom = (pjsip_sip_uri *)from;
+ callerName = std::string(pj_strbuf(&sipFrom->user), pj_strlen(&sipFrom->user));
+ }
+ SipEndpointPtr* caller = new SipEndpointPtr(factory->findByName(callerName));
+ if (caller == 0)
+ {
+ pjsip_inv_answer(inv_session, 404, NULL, NULL, &tdata);
+ pjsip_inv_send_msg(inv_session, tdata);
+ return;
+ }
(*caller)->setInviteSession(inv_session);
(*caller)->setDialog(dlg);
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list