--- chan_sip.c.orig 2004-05-08 15:49:38.000000000 -0500 +++ chan_sip.c 2004-05-08 16:17:42.000000000 -0500 @@ -60,6 +60,10 @@ #include #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 @@ -123,6 +127,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] = ""; @@ -2585,7 +2591,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 @@ -2683,7 +2689,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; } @@ -3167,7 +3173,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); } static int transmit_invite(struct sip_pvt *p, char *cmd, int sdp, char *auth, char *authheader, char *vxml_url, char *distinctive_ring, int init) @@ -3474,7 +3480,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); @@ -7027,6 +7033,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")) {