[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
Thu Aug 26 08:36:42 CDT 2010


branch "master" has been updated
       via  3a708f29ef51b918256a6dad526980b639ef32ef (commit)
      from  a0045b6caf7e38f2fbf8353ea3a2d1e71fbcc229 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit 3a708f29ef51b918256a6dad526980b639ef32ef
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Aug 26 10:48:30 2010 -0300

    Record our invite session on the endpoint so responses can be sent, and use the inv_session callback for handling responses.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 8d9e2af..6011e73 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -111,6 +111,7 @@ static void handle_new_invite(pjsip_rx_data *rdata)
 	//XXX Hardcoded "Butt" is bad for a lot of reasons,
 	//but for now have it there just so stuff'll compile!
 	SipEndpointPtr* caller = new SipEndpointPtr(factory->createEndpoint("Butt"));
+	(*caller)->setInviteSession(inv_session);
 
 	//We've created our calling endpoint. Now we need to look up the destination.
 	pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;
@@ -213,9 +214,10 @@ static pj_bool_t sessionOnReceiveRequest(pjsip_rx_data *rdata)
 	return PJ_TRUE;
 }
 
-static void handle_invite_response(pjsip_rx_data *rdata)
+static void handle_invite_response(pjsip_rx_data *rdata, pjsip_dialog *dlg)
 {
 	int respCode = rdata->msg_info.msg->line.status.code;
+	SipEndpointPtr *endpoint = (SipEndpointPtr*)dlg->mod_data[pjsip_ua_instance()->id];
 	//Commented because they are currently unused. They
 	//will be once the individual cases are mapped out.
 	//pjsip_dialog *dlg = pjsip_rdata_get_dlg(rdata);
@@ -257,6 +259,7 @@ static void handle_invite_response(pjsip_rx_data *rdata)
 		//For now treat all failures the same. Call the
 		//caller's signalcallback's terminated()
 		std::cout << "[DEBUG] Got response " << respCode << "on outgoing INVITE" << std::endl;
+		(*endpoint)->getSignalCallback()->busy((*endpoint)->getSessionEndpoint()->id);
 	}
 }
 
@@ -275,7 +278,7 @@ static pj_bool_t sessionOnReceiveResponse(pjsip_rx_data *rdata)
 	{
 	case PJSIP_INVITE_METHOD:
 	{
-		handle_invite_response(rdata);
+		handle_invite_response(rdata, dlg);
 		break;
 	}
 	case PJSIP_BYE_METHOD:
@@ -320,6 +323,10 @@ static void sessionOnTransactionStateChange(pjsip_transaction *tsx, pjsip_event
 
 static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
 {
+   if (inv->state == PJSIP_INV_STATE_DISCONNECTED)
+   {
+      std::cout << "Invite session " << inv << " is disconnected" << std::endl;
+   }
 	//stub
 }
 
@@ -330,6 +337,10 @@ static void invOnNewSession(pjsip_inv_session *inv, pjsip_event *event)
 
 static void invOnTransactionStateChanged(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
 {
+   if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG)
+   {
+	   handle_invite_response(e->body.tsx_state.src.rdata, inv->dlg);
+   }
 	//stub
 }
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list