[Asterisk-cvs] asterisk/channels chan_sip.c,1.395,1.396

markster at lists.digium.com markster at lists.digium.com
Tue May 25 01:22:47 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv17394/channels

Modified Files:
	chan_sip.c 
Log Message:
Merge useragent patch (bug #712)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.395
retrieving revision 1.396
diff -u -d -r1.395 -r1.396
--- chan_sip.c	24 May 2004 14:44:47 -0000	1.395
+++ chan_sip.c	25 May 2004 05:36:49 -0000	1.396
@@ -60,6 +60,10 @@
 #include <mysql/mysql.h>
 #endif
 
+#ifndef DEFAULT_USERAGENT
+#define DEFAULT_USERAGENT "Asterisk PBX"
+#endif
+ 
 #define VIDEO_CODEC_MASK        0x1fc0000 /* Video codecs from H.261 thru AST_FORMAT_MAX_VIDEO */
 #ifndef IPTOS_MINCOST
 #define IPTOS_MINCOST 0x02
@@ -126,6 +130,8 @@
 
 #define ALLOWED_METHODS "INVITE, ACK, CANCEL, OPTIONS, BYE, REFER"
 
+static char useragent[AST_MAX_EXTENSION] = DEFAULT_USERAGENT;
+
 static char context[AST_MAX_EXTENSION] = "default";
 
 static char language[MAX_LANGUAGE] = "";
@@ -2787,7 +2793,7 @@
 	add_header(resp, "To", ot);
 	copy_header(resp, req, "Call-ID");
 	copy_header(resp, req, "CSeq");
-	add_header(resp, "User-Agent", "Asterisk PBX");
+	add_header(resp, "User-Agent", useragent);
 	add_header(resp, "Allow", ALLOWED_METHODS);
 	if (p->expiry) {
 		/* For registration responses, we also need expiry and
@@ -2885,7 +2891,7 @@
 	copy_header(req, orig, "Call-ID");
 	add_header(req, "CSeq", tmp);
 
-	add_header(req, "User-Agent", "Asterisk PBX");
+	add_header(req, "User-Agent", useragent);
 	return 0;
 }
 
@@ -3389,7 +3395,7 @@
 	add_header(req, "Contact", p->our_contact);
 	add_header(req, "Call-ID", p->callid);
 	add_header(req, "CSeq", tmp);
-	add_header(req, "User-Agent", "Asterisk PBX");
+	add_header(req, "User-Agent", useragent);
 }
 
         
@@ -3708,7 +3714,7 @@
 	add_header(&req, "To", to);
 	add_header(&req, "Call-ID", p->callid);
 	add_header(&req, "CSeq", tmp);
-	add_header(&req, "User-Agent", "Asterisk PBX");
+	add_header(&req, "User-Agent", useragent);
 	if (auth) 
 		add_header(&req, authheader, auth);
 
@@ -7468,6 +7474,9 @@
 			strncpy(context, v->value, sizeof(context)-1);
 		} else if (!strcasecmp(v->name, "realm")) {
 			strncpy(global_realm, v->value, sizeof(global_realm)-1);
+		} else if (!strcasecmp(v->name, "useragent")) {
+			strncpy(useragent, v->value, sizeof(useragent)-1);
+			ast_log(LOG_DEBUG, "Setting User Agent Name to %s\n", useragent);
 		} else if (!strcasecmp(v->name, "relaxdtmf")) {
 			relaxdtmf = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "dtmfmode")) {




More information about the svn-commits mailing list