[asterisk-commits] mmichelson: branch group/pimp_my_sip r379883 - in /team/group/pimp_my_sip: ma...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 22 12:19:04 CST 2013


Author: mmichelson
Date: Tue Jan 22 12:19:01 2013
New Revision: 379883

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379883
Log:
Add a skeleton for the inv_on_state_changed callback.

This simply puts out debug statements right now. It will be
changed to call session supplements as necessary.


Modified:
    team/group/pimp_my_sip/main/loader.c
    team/group/pimp_my_sip/res/res_sip_session.c

Modified: team/group/pimp_my_sip/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/main/loader.c?view=diff&rev=379883&r1=379882&r2=379883
==============================================================================
--- team/group/pimp_my_sip/main/loader.c (original)
+++ team/group/pimp_my_sip/main/loader.c Tue Jan 22 12:19:01 2013
@@ -842,6 +842,7 @@
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
+	printf ("!!! Going to load %s\n", mod->resource);
 	res = mod->info->load();
 
 	switch (res) {

Modified: team/group/pimp_my_sip/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/res/res_sip_session.c?view=diff&rev=379883&r1=379882&r2=379883
==============================================================================
--- team/group/pimp_my_sip/res/res_sip_session.c (original)
+++ team/group/pimp_my_sip/res/res_sip_session.c Tue Jan 22 12:19:01 2013
@@ -538,9 +538,9 @@
 
 static pjsip_inv_session *pre_session_setup(pjsip_rx_data *rdata)
 {
-	pjsip_tx_data *tdata = NULL;
-	pjsip_dialog *dlg = NULL;
-	pjsip_inv_session *inv_session = NULL;
+	pjsip_tx_data *tdata;
+	pjsip_dialog *dlg;
+	pjsip_inv_session *inv_session;
 	unsigned int options = 0;
 
 	if (pjsip_inv_verify_request(rdata, &options, NULL, NULL, ast_sip_get_pjsip_endpoint(), &tdata) != PJ_SUCCESS) {
@@ -730,7 +730,43 @@
 
 static void session_inv_on_state_changed(pjsip_inv_session *inv, pjsip_event *e)
 {
-	/* XXX STUB */
+	ast_debug(3, "on_state_changed callback called. Event dump to follow\n");
+	ast_debug(3, "inv state is %s, event type is %s\n", pjsip_inv_state_name(inv->state), pjsip_event_str(e->type));
+	switch(e->type) {
+	case PJSIP_EVENT_TX_MSG:
+		ast_debug(3, "Sending %s\n", e->body.tx_msg.tdata->msg->type == PJSIP_REQUEST_MSG ? "request" : "response");
+		if (e->body.tx_msg.tdata->msg->type == PJSIP_REQUEST_MSG) {
+			struct pjsip_request_line req = e->body.tx_msg.tdata->msg->line.req;
+			ast_debug(3, "Method is %.*s\n", (int) pj_strlen(&req.method.name),
+					pj_strbuf(&req.method.name));
+		} else {
+			struct pjsip_status_line status = e->body.tx_msg.tdata->msg->line.status;
+			ast_debug(3, "Response is %d %.*s\n", status.code, (int) pj_strlen(&status.reason),
+					pj_strbuf(&status.reason));
+		}
+		break;
+	case PJSIP_EVENT_RX_MSG:
+		ast_debug(3, "Received %s\n", e->body.rx_msg.rdata->msg_info.msg->type == PJSIP_REQUEST_MSG ? "request" : "response");
+		if (e->body.rx_msg.rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) {
+			struct pjsip_request_line req = e->body.rx_msg.rdata->msg_info.msg->line.req;
+			ast_debug(3, "Method is %.*s\n", (int) pj_strlen(&req.method.name),
+					pj_strbuf(&req.method.name));
+		} else {
+			struct pjsip_status_line status = e->body.rx_msg.rdata->msg_info.msg->line.status;
+			ast_debug(3, "Response is %d %.*s\n", status.code, (int) pj_strlen(&status.reason),
+					pj_strbuf(&status.reason));
+		}
+		break;
+	case PJSIP_EVENT_TSX_STATE:
+		ast_debug(3, "Source of transaction state change is %s\n", pjsip_event_str(e->body.tsx_state.type));
+		break;
+	case PJSIP_EVENT_TRANSPORT_ERROR:
+	case PJSIP_EVENT_TIMER:
+	case PJSIP_EVENT_UNKNOWN:
+	case PJSIP_EVENT_USER:
+	default:
+		break;
+	}
 }
 
 static void session_inv_on_new_session(pjsip_inv_session *inv, pjsip_event *e)




More information about the asterisk-commits mailing list