Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.796 diff -u -r1.796 chan_sip.c --- channels/chan_sip.c 27 Jul 2005 02:17:06 -0000 1.796 +++ channels/chan_sip.c 28 Jul 2005 14:38:45 -0000 @@ -277,6 +277,9 @@ #define DEFAULT_CONTEXT "default" static char default_context[AST_MAX_CONTEXT] = DEFAULT_CONTEXT; +#define DEFAULT_VMEXTEN "asterisk" +static char global_vmexten[AST_MAX_EXTENSION] = DEFAULT_VMEXTEN; + static char default_language[MAX_LANGUAGE] = ""; #define DEFAULT_CALLERID "asterisk" @@ -662,6 +665,7 @@ int incominglimit; /* Limit of incoming calls */ int outUse; /* disabled */ int outgoinglimit; /* disabled */ + char vmexten[AST_MAX_EXTENSION]; /* Dialplan extension for MWI notify message*/ char mailbox[AST_MAX_EXTENSION]; /* Mailbox setting for MWI checks */ char language[MAX_LANGUAGE]; /* Default language for prompts */ char musicclass[MAX_MUSICCLASS];/* Music on Hold class */ @@ -4557,7 +4561,7 @@ * We use the SIP Event package message-summary * MIME type defaults to "application/simple-message-summary"; */ -static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs) +static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, char *vmexten) { struct sip_request req; char tmp[500]; @@ -4568,6 +4572,7 @@ add_header(&req, "Event", "message-summary"); add_header(&req, "Content-Type", default_notifymime); + ast_build_string(&t, &maxbytes, "Message-Account: sip:%s@%s\r\n", (vmexten && !ast_strlen_zero(vmexten)) ? vmexten : global_vmexten, p->fromdomain); ast_build_string(&t, &maxbytes, "Messages-Waiting: %s\r\n", newmsgs ? "yes" : "no"); ast_build_string(&t, &maxbytes, "Voice-Message: %d/%d (0/0)\r\n", newmsgs, oldmsgs); @@ -7088,6 +7093,7 @@ ast_cli(fd, " Pickupgroup : "); print_group(fd, peer->pickupgroup); ast_cli(fd, " Mailbox : %s\n", peer->mailbox); + ast_cli(fd, " VM Extension : %s\n", peer->vmexten); ast_cli(fd, " LastMsgsSent : %d\n", peer->lastmsgssent); ast_cli(fd, " Inc. limit : %d\n", peer->incominglimit); ast_cli(fd, " Outg. limit : %d\n", peer->outgoinglimit); @@ -9843,7 +9849,7 @@ build_callid(p->callid, sizeof(p->callid), p->ourip, p->fromdomain); /* Send MWI */ ast_set_flag(p, SIP_OUTGOING); - transmit_notify_with_mwi(p, newmsgs, oldmsgs); + transmit_notify_with_mwi(p, newmsgs, oldmsgs, peer->vmexten); sip_scheddestroy(p, 15000); return 0; } @@ -10612,6 +10618,7 @@ peer->chanvars = NULL; } strcpy(peer->context, default_context); + strcpy(peer->vmexten, global_vmexten); strcpy(peer->language, default_language); strcpy(peer->musicclass, global_musicclass); ast_copy_flags(peer, &global_flags, SIP_USEREQPHONE); @@ -10750,6 +10757,8 @@ ast_copy_string(peer->musicclass, v->value, sizeof(peer->musicclass)); } else if (!strcasecmp(v->name, "mailbox")) { ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox)); + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(peer->vmexten, v->value, sizeof(peer->vmexten)); } else if (!strcasecmp(v->name, "callgroup")) { peer->callgroup = ast_get_group(v->value); } else if (!strcasecmp(v->name, "pickupgroup")) { @@ -10885,6 +10894,7 @@ ast_set_flag(&global_flags, SIP_NAT_RFC3581); ast_set_flag(&global_flags, SIP_CAN_REINVITE); global_mwitime = DEFAULT_MWITIME; + strcpy(global_vmexten, DEFAULT_VMEXTEN); srvlookup = 0; autocreatepeer = 0; regcontext[0] = '\0'; @@ -10931,6 +10941,8 @@ ast_log(LOG_WARNING, "'%s' is not a valid MWI time setting at line %d. Using default (10).\n", v->value, v->lineno); global_mwitime = DEFAULT_MWITIME; } + } else if (!strcasecmp(v->name, "vmexten")) { + ast_copy_string(global_vmexten, v->value, sizeof(global_vmexten)); } else if (!strcasecmp(v->name, "rtptimeout")) { if ((sscanf(v->value, "%d", &global_rtptimeout) != 1) || (global_rtptimeout < 0)) { ast_log(LOG_WARNING, "'%s' is not a valid RTP hold time at line %d. Using default.\n", v->value, v->lineno); Index: configs/sip.conf.sample =================================================================== RCS file: /usr/cvsroot/asterisk/configs/sip.conf.sample,v retrieving revision 1.64 diff -u -r1.64 sip.conf.sample --- configs/sip.conf.sample 9 Jun 2005 21:11:30 -0000 1.64 +++ configs/sip.conf.sample 28 Jul 2005 14:38:49 -0000 @@ -49,6 +49,9 @@ ;defaultexpirey=120 ; Default length of incoming/outoing registration ;notifymimetype=text/plain ; Allow overriding of mime type in MWI NOTIFY ;checkmwi=10 ; Default time between mailbox checks for peers +;vmexten=voicemail ; dialplan extension to reach mailbox sets the + ; Message-Account in the MWI notify message + ; defaults to "asterisk" ;videosupport=yes ; Turn on support for SIP video ;recordhistory=yes ; Record SIP history by default ; (see sip history / sip no history) @@ -318,6 +321,9 @@ ;defaultip=192.168.0.59 ; IP used until peer registers ;username=snom ; Username to use in INVITE until peer registers ;mailbox=1234@context,2345 ; Mailbox(-es) for message waiting indicator +;vmexten=voicemail ; dialplan extension to reach mailbox + ; sets the Message-Account in the MWI notify message + ; defaults to global vmexten which defaults to "asterisk" ;restrictcid=yes ; To have the callerid restriced -> sent as ANI ;disallow=all ;allow=ulaw ; dtmfmode=inband only works with ulaw or alaw!