[svn-commits] file: branch file/pimp_sip_location r381608 - in /team/file/pimp_sip_location...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Feb 16 06:40:29 CST 2013


Author: file
Date: Sat Feb 16 06:40:25 2013
New Revision: 381608

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381608
Log:
Make it so receiving 200 OKs from multiple legs doesn't cause insanity.

Modified:
    team/file/pimp_sip_location/channels/chan_gulp.c
    team/file/pimp_sip_location/res/res_sip_session.c

Modified: team/file/pimp_sip_location/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/channels/chan_gulp.c?view=diff&rev=381608&r1=381607&r2=381608
==============================================================================
--- team/file/pimp_sip_location/channels/chan_gulp.c (original)
+++ team/file/pimp_sip_location/channels/chan_gulp.c Sat Feb 16 06:40:25 2013
@@ -136,10 +136,16 @@
 static struct ast_channel *gulp_new(struct ast_sip_session *session, int state, const char *exten, const char *title, const char *linkedid, const char *cid_name)
 {
 	struct ast_channel *chan;
+	RAII_VAR(struct ast_uuid *, uuid, ast_uuid_generate(), ast_free_ptr);
+	char uuid_str[AST_UUID_STR_LEN];
 	struct ast_format fmt;
 
-	if (!(chan = ast_channel_alloc(1, state, "", S_OR(cid_name, ""), "", "", "", linkedid, 0, "Gulp/%s-%.*s", ast_sorcery_object_get_id(session->endpoint),
-		(int)session->inv_session->dlg->call_id->id.slen, session->inv_session->dlg->call_id->id.ptr))) {
+	if (!uuid) {
+		return NULL;
+	}
+
+	if (!(chan = ast_channel_alloc(1, state, "", S_OR(cid_name, ""), "", "", "", linkedid, 0, "Gulp/%s-%s", ast_sorcery_object_get_id(session->endpoint),
+		ast_uuid_to_str(uuid, uuid_str, AST_UUID_STR_LEN)))) {
 		return NULL;
 	}
 

Modified: team/file/pimp_sip_location/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip_session.c?view=diff&rev=381608&r1=381607&r2=381608
==============================================================================
--- team/file/pimp_sip_location/res/res_sip_session.c (original)
+++ team/file/pimp_sip_location/res/res_sip_session.c Sat Feb 16 06:40:25 2013
@@ -472,11 +472,6 @@
 	ao2_link_flags(session->legs, leg, OBJ_NOLOCK);
 	inv_session->mod_data[session_module.id] = session;
 
-	/* If no main invite session yet exists be optimistic and use this one */
-	if (!session->inv_session) {
-		session->inv_session = inv_session;
-	}
-
 	return 0;
 }
 
@@ -506,8 +501,11 @@
 	if (!session->legs) {
 		return NULL;
 	}
-	if (inv_session && sip_session_add_leg(session, inv_session)) {
-		return NULL;
+	if (inv_session) {
+		if (sip_session_add_leg(session, inv_session)) {
+			return NULL;
+		}
+		session->inv_session = inv_session;
 	}
 	if (add_supplements(session)) {
 		return NULL;
@@ -1027,6 +1025,10 @@
 
 	/* If the remote side has answered end all other legs and treat this as the main invite session */
 	if (status.code == 200) {
+		/* If the session has already been answered drop this response and don't send it to any supplements */
+		if (session->inv_session) {
+			return;
+		}
 		sip_session_leg_answered(session, inv_session);
 	}
 




More information about the svn-commits mailing list