[svn-commits] rizzo: trunk r44675 - /trunk/channels/chan_sip.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Oct 7 05:50:43 MST 2006


Author: rizzo
Date: Sat Oct  7 07:50:42 2006
New Revision: 44675

URL: http://svn.digium.com/view/asterisk?rev=44675&view=rev
Log:
slightly restructure the code that computes the channel's name


Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=44675&r1=44674&r2=44675&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Oct  7 07:50:42 2006
@@ -3716,12 +3716,16 @@
 	}
 
 
-	if (title)
-		 ast_string_field_build(tmp, name, "SIP/%s-%08x", title, (int)(long) i);
-	else if (strchr(i->fromdomain,':'))
-		ast_string_field_build(tmp, name, "SIP/%s-%08x", strchr(i->fromdomain,':') + 1, (int)(long) i);
-	else
-		ast_string_field_build(tmp, name, "SIP/%s-%08x", i->fromdomain, (int)(long) i);
+	{
+		const char *my_name;	/* pick a good name */
+		if (title)
+			my_name = title;
+		else if ( (my_name = strchr(i->fromdomain,':')) )
+			my_name++;	/* skip ':' */
+		else
+			my_name = i->fromdomain;
+		ast_string_field_build(tmp, name, "SIP/%s-%08x", my_name, (int)(long) i);
+	}
 
 	if (ast_test_flag(&i->flags[0], SIP_DTMF) ==  SIP_DTMF_INBAND) {
 		i->vad = ast_dsp_new();



More information about the svn-commits mailing list