[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Dec 19 17:10:55 CST 2011
branch "master" has been updated
via 44a2f27c3a9ed47cb881c88c02ea6f91b3ee3084 (commit)
via 4aa216e43cea3860439e9b7adf16f42a430fa3b1 (commit)
via bf884a73730e769375added2f477bc278c79d6ea (commit)
via 98f8e367eacec34fa09ceb7e8f703dfe9f548200 (commit)
from 2862a336044a0f52462db837cc4b03660d2bb253 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 71 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 44a2f27c3a9ed47cb881c88c02ea6f91b3ee3084
Merge: 2862a33 4aa216e
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Dec 19 17:07:16 2011 -0600
Merge branch 'redirect'
commit 4aa216e43cea3860439e9b7adf16f42a430fa3b1
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Oct 31 10:24:55 2011 -0500
Add a comment explaining something.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 61809ee..2b0b571 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -1552,6 +1552,8 @@ protected:
SessionRouterPrx router =
SessionRouterPrx::uncheckedCast(asyncResult->getProxy());
+ //We default to the STOP state. This way, when the redirection
+ //is successful, PJSIP will not do anything further redirecting.
pjsip_redirect_op op = PJSIP_REDIRECT_STOP;
try
commit bf884a73730e769375added2f477bc278c79d6ea
Author: Mark Michelson <mmichelson at digium.com>
Date: Fri Oct 28 13:26:56 2011 -0500
Add redirecting support to the session manager.
This doesn't add redirecting party info into the forwarded call at this
point. It will be easier to do once the party-id branch is merged.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 5e5e8dc..61809ee 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -1518,37 +1518,73 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t)
class HandleRedirection : public SipQueueableOperation
{
public:
- HandleRedirection(pjsip_inv_session *inv, const std::vector<pjsip_contact_hdr*>& contacts)
- : mInv(inv), mContacts(contacts) { }
+ HandleRedirection(pjsip_inv_session *inv,
+ const std::string& contact,
+ const AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx>& router,
+ const SipSessionPtr& session)
+ : mInv(inv), mContact(contact), mRouter(router), mSession(session) { }
protected:
- SuspendableWorkResult execute (const SuspendableWorkListenerPtr&)
+ SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
{
- for (std::vector<pjsip_contact_hdr*>::iterator iter = mContacts.begin();
- iter != mContacts.end(); ++iter)
+ try
{
- pjsip_sip_uri *sipURI = (pjsip_sip_uri*) pjsip_uri_get_uri((*iter)->uri);
+ SuspendableWorkListenerPtr listener = 0;
+ SipAMICallbackPtr cb(new SipAMICallback(listener, mSession, this, false, true));
+ Ice::CallbackPtr d = Ice::newCallback(cb, &SipAMICallback::callback);
+ mRouter->begin_connectBridgedSessionsWithDestination(
+ IceUtil::generateUUID(),
+ mSession->getSessionProxy(),
+ mContact,
+ true,
+ 0,
+ d);
+ }
+ catch (const Ice::CommunicatorDestroyedException&)
+ {
+ pjsip_inv_process_redirect(mInv, PJSIP_REDIRECT_REJECT, NULL);
+ }
+ return Complete;
+ }
+
+ SuspendableWorkResult calledBack(const Ice::AsyncResultPtr& asyncResult)
+ {
+ SessionRouterPrx router =
+ SessionRouterPrx::uncheckedCast(asyncResult->getProxy());
+
+ pjsip_redirect_op op = PJSIP_REDIRECT_STOP;
+ try
+ {
+ router->end_connectBridgedSessionsWithDestination(asyncResult);
+ }
+ catch (const std::exception&)
+ {
+ op = PJSIP_REDIRECT_REJECT;
}
- pjsip_inv_process_redirect(mInv, PJSIP_REDIRECT_STOP, NULL);
+
+ pjsip_inv_process_redirect(mInv, op, NULL);
+ return Complete;
}
+
private:
pjsip_inv_session *mInv;
- std::vector<pjsip_contact_hdr*> mContacts;
+ const std::string mContact;
+ AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> mRouter;
+ SipSessionPtr mSession;
};
-pjsip_redirect_op PJSipSessionModule::invOnRedirected(pjsip_inv_session*, const pjsip_uri*,
+pjsip_redirect_op PJSipSessionModule::invOnRedirected(pjsip_inv_session* inv, const pjsip_uri* uri,
const pjsip_event*)
{
- std::vector<pjsip_contact_hdr *> contacts;
- pjsip_contact_hdr *contact = (pjsip_contact_hdr *) &rdata->msg_info.msg->hdr;
- while ((contact = (pjsip_contact_hdr *) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, contact->next)))
- {
- pjsip_contact_hdr *newContact = pjsip_contact_hdr_create(rdata->tp_info.pool);
- contacts.push_back(newContact);
- }
+ pjsip_sip_uri *sipURI = (pjsip_sip_uri *) pjsip_uri_get_uri(uri);
+
+ std::string contact(pj_strbuf(&sipURI->user), pj_strlen(&sipURI->user));
+
+ PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*) inv->mod_data[mModule.id];
+ SipSessionPtr session = session_mod_info->getSessionPtr();
- enqueueSessionWork(new HandleRedirection(inv, contacts));
+ enqueueSessionWork(new HandleRedirection(inv, contact, mSessionRouter, session), inv);
return PJSIP_REDIRECT_PENDING;
}
commit 98f8e367eacec34fa09ceb7e8f703dfe9f548200
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Oct 27 17:44:16 2011 -0500
Add initial redirection work.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 9504d47..5e5e8dc 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -1515,11 +1515,41 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t)
enqueueSessionWork(new HandleMediaUpdate(inv, mModule.id, mServiceLocator), inv);
}
+class HandleRedirection : public SipQueueableOperation
+{
+public:
+ HandleRedirection(pjsip_inv_session *inv, const std::vector<pjsip_contact_hdr*>& contacts)
+ : mInv(inv), mContacts(contacts) { }
+
+protected:
+ SuspendableWorkResult execute (const SuspendableWorkListenerPtr&)
+ {
+ for (std::vector<pjsip_contact_hdr*>::iterator iter = mContacts.begin();
+ iter != mContacts.end(); ++iter)
+ {
+ pjsip_sip_uri *sipURI = (pjsip_sip_uri*) pjsip_uri_get_uri((*iter)->uri);
+
+ }
+ pjsip_inv_process_redirect(mInv, PJSIP_REDIRECT_STOP, NULL);
+ }
+private:
+ pjsip_inv_session *mInv;
+ std::vector<pjsip_contact_hdr*> mContacts;
+};
+
pjsip_redirect_op PJSipSessionModule::invOnRedirected(pjsip_inv_session*, const pjsip_uri*,
const pjsip_event*)
{
- //stub
- return PJSIP_REDIRECT_REJECT;
+ std::vector<pjsip_contact_hdr *> contacts;
+ pjsip_contact_hdr *contact = (pjsip_contact_hdr *) &rdata->msg_info.msg->hdr;
+ while ((contact = (pjsip_contact_hdr *) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, contact->next)))
+ {
+ pjsip_contact_hdr *newContact = pjsip_contact_hdr_create(rdata->tp_info.pool);
+ contacts.push_back(newContact);
+ }
+
+ enqueueSessionWork(new HandleRedirection(inv, contacts));
+ return PJSIP_REDIRECT_PENDING;
}
pjsip_dialog *PJSipSessionModule::uaOnDialogForked(pjsip_dialog*, pjsip_rx_data*)
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list