<DIV>Here is relevant portion of sip.conf. for those peer softswitches....I have tested with 2 Clarent Softswitches one with 3 and other with just one mailbox..worked fine. I will go to bugs.digium.com..and submit a case....Thx</DIV>
<DIV> </DIV>
<DIV>I followed the NOTIFY mechanism for sending MWI as per RFC 3842....</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>---------------------------------------------------------------sip.conf---------------------------------------</DIV>
<DIV>[10.1.1.1:5080] //This sofswitch uses port 5080 for VoiceMail...we do have to </DIV>
<DIV> explicitly mention the port here so that Asterisk does not loose it while </DIV>
<DIV> sending NOTIFY to Softswitches..I found out that Asterisk does loose </DIV>
<DIV> this port.<BR>type=friend<BR>username=c5cm<BR>context=clarentcm<BR>dtmfmode=rfc2833<BR>host=10.1.1.1<BR><A href="mailto:mailbox=12895551001@suppc5cm1,12895551002@suppc5cm1,12455551000@suppc5cm1">mailbox=12895551001@suppc5cm1,12895551002@suppc5cm1,12455551000@suppc5cm1</A><BR>allow=ulaw<BR>port=5080</DIV>
<DIV>[10.1.1.2:5080]<BR>type=friend<BR>context=JerryC5_84<BR>dtmfmode=rfc2833<BR>host=10.1.1.2</DIV>
<DIV><A href="mailto:mailbox=15142550001@jerryc5vm">mailbox=15142550001@jerryc5vm</A><BR>allow=ulaw<BR>port=5080</DIV>
<DIV>--------------------------------------------------------------------------------------------------------------------------------------------<BR><BR><BR><B><I>John Todd <jtodd@loligo.com></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>This looks interesting. Can you provide a bit more detail and some <BR>other updates?<BR><BR>1) Can you supply a diff on the sip.conf file that shows an example <BR>of your new method (comment the section out, and use several lines of <BR>comments to explain what the example does)<BR><BR>2) On what softswitches is this known to work? I assume you've <BR>tested with SER, as a baseline?<BR><BR>3) Have you signed a disclaimer with Digium?<BR><BR>4) Can you submit this as an addition to bugs.digium.com so that it <BR>will be included in future Asterisk releases if it meets approval and <BR>functionality criteria (as nebulous as both of those are...)?<BR><BR>JT<BR><BR><BR>At 11:05 AM -0700 on 4/14/05, Jay Ray wrote:<BR>>Hi All,<BR>><BR>> I had proposed the changes to be able to support Asterisk <BR>>VoiceMail for 3rd Party Softswitches. Here is what I have changed on
<BR>>Asterisk in chan_sip.c<BR>><BR>>While in function sip_send_mwi_to_peer() . in case peer->tohost has <BR>>a value which means that its not a registered EP - but a static <BR>>peer, I call another function called sip_send_mwi_to_softswitch() <BR>>.....in which I separate the comma separated mailboxes defined in <BR>>sip.conf for that peer. and send NOTIFY in a for loop for each of <BR>>the Mailboxes....by calling another new function <BR>> transmit_notify_to_softswitch_with_mwi()<BR>><BR>>In transmit_notify_to_softswitch_with_mwi() , I populate the <BR>>sip_pvt->username with the mailbox number (minus the mailbox <BR>>context, if any)...so that the mailbox number gets added to the "TO" <BR>>header in the NOTIFY going out to that Softswitch...for the <BR>>Softswitch to pass on the NOTIFY to the appropriate Endpoint....<BR>><BR>>The DIFF is below, comments
appreciated.......<BR>><BR>><BR>><BR>><BR>>[root@jerrylinux channels]# diff chan_sip.c.wrking1 chan_sip.c.orig<BR>>489,490d488<BR>>< int *lastmsgsent_switch; /* maintaining last message <BR>>sent for EPS on a Third Party Softswitch */<BR>><<BR>>1207c1205<BR>><<BR>>---<BR>>><BR>>1209d1206<BR>><<BR>>1212d1208<BR>><<BR>>3930,3932d3925<BR>><<BR>><<BR>><<BR>>4217,4271d4209<BR>>< /*--- transmit_notify_to_softswitch_with_mwi: Notify Softswitch user of<BR>>< messages waiting in voicemail ---*/<BR>>< /* Notification works for Softswitch peers with mailbox= definitions<BR>>< * in sip.conf<BR>>< * We use the SIP Event package message-summary<BR>>< * MIME type defaults to "application/simple-message-summary";<BR>>< */<BR>>< static int transmit_notify_to_softswitch_with_mwi(struct sip_pvt <BR>>*p, char *mbox, int newmsgs, int oldmsgs)<BR>><
{<BR>>< struct sip_request req;<BR>>< char tmp[256];<BR>>< char tmp2[256];<BR>>< char *tmp_mbox;<BR>>< char clen[20];<BR>><<BR>>< /* I will put the Mailbox Number - the part before the @<BR>>< * in p->username, and then call initreqprep as initreqprep<BR>>< * looks for a p->username and puts it in TO Header<BR>>< */<BR>><<BR>>< tmp_mbox = (char*) calloc(strlen(mbox), sizeof(char));<BR>><<BR>>< strncpy(tmp_mbox, mbox, strlen(mbox));<BR>><<BR>>< tmp_mbox = strsep(&tmp_mbox, "@");<BR>><<BR>>< strncpy(p->username, tmp_mbox, strlen(tmp_mbox));<BR>><<BR>><<BR>><<BR>>< initreqprep(&req, p, "NOTIFY", NULL);<BR>><<BR>>< add_header(&req, "Event", "message-summary");<BR>>< add_header(&req, "Content-Type", default_notifymime);<BR>><<BR>>< snprintf(tmp, sizeof(tmp), "Messages-Waiting: %s\r\n", <BR>>newmsgs ?
"yes" : "no");<BR>>< snprintf(tmp2, sizeof(tmp2), "Voice-Message: %d/%d\r \n", <BR>>newmsgs, oldmsgs);<BR>>< snprintf(clen, sizeof(clen), "%d", (int)(strlen(tmp) + <BR>>strlen(tmp2)));<BR>>< add_header(&req, "Content-Length", clen);<BR>>< add_line(&req, tmp);<BR>>< add_line(&req, tmp2);<BR>><<BR>>< if (!p->initreq.headers) {<BR>>< /* Use this as the basis */<BR>>< copy_request(&p->initreq, &req);<BR>>< parse(&p->initreq);<BR>>< if (sip_debug_test_pvt(p))<BR>>< ast_verbose("%d headers, %d lines\n", <BR>>p->initreq.headers, p->initreq.lines);<BR>>< determine_firstline_parts(&p->initreq);<BR>>< }<BR>><<BR>>< return send_request(p, &req, 1, p->ocseq);<BR>>< }<BR>><<BR>><<BR>>8628,8734d8565<BR>>< //Ujju - sip_send_mwi_to_softswitch : Sending MWI to another Softswitch.<BR>>< static int
sip_send_mwi_to_softswitch(struct sip_peer *peer)<BR>>< {<BR>>< /* Checking for all the m alboxes configured for a softswitch<BR>>< and sending NOTIFY w/MWI for all */<BR>>< struct sip_pvt *p;<BR>>< char name[256] = "";<BR>>< int newmsgs, oldmsgs;<BR>><<BR>>< if(peer->mailbox==NULL){<BR>>< ast_log(LOG_WARNING, "No Mailboxes defined in sip.conf and <BR>>voicemail.conf for this softswitch");<BR>>< return 0;<BR>>< }<BR>><<BR>>< int i;<BR>>< int mbox_count=0;<BR>>< char *mbox[500]; /*Pointer to individual malboxes*/<BR>>< char *tmp=NULL; /*Temp Pointer to individual mailboxes*/<BR>>< char *mailboxes;/* storing full comma separated mailbox <BR>>string here */<BR>><<BR>>< mailboxes=(char *)calloc(strlen(peer->mailbox),sizeof(char));<BR>><<BR>>< strcpy(mailboxes,peer->mailbox);<BR>><<BR>><<BR>>< tmp=strchr(mailboxes,',');<BR>><
//**mbox=(char **)malloc(sizeof(char *)*256);<BR>>< //This copies first Mailbox in mbox[0]<BR>>< mbox[mbox_count]=mailboxes;<BR>>< mbox[mbox_count]=strsep(&mbox[mbox_count], ",");<BR>><<BR>>< //This copies rest of the mailboxes in mbox[1, 2, 3......]<BR>>< while(tmp!=NULL)<BR>>< {<BR>>< mbox_count++;<BR>>< tmp+=1;<BR>>< mbox[mbox_count]=(char*) calloc(strlen(tmp), sizeof(char));<BR>>< strncpy(mbox[mbox_count],tmp, strlen(tmp));<BR>>< mbox[mbox_count]=strsep(&mbox[mbox_count], ",");<BR>>< tmp=strchr(tmp,',');<BR>>< }<BR>><<BR>><<BR>>< /* Allocating memory for PTR to last msg for each mailbox <BR>>for EPs on Softswitch */<BR>>< if (peer->lastmsgsent_switch == NULL) {<BR>>< peer->lastmsgsent_switch = (int *) <BR>>calloc(mbox_count,sizeof(int));<BR>>< for (i=0;i<=mbox_count;i++)<BR>>< peer->lastmsgsent_switch[i]=-1;<BR>><
}<BR>><<BR>><<BR>>< //Now looping through all the Mailboxes to send individual Notify's<BR>>< for(i=0;i<=mbox_count;i++) {<BR>><<BR>><<BR>>< ast_app_messagecount(mbox[i], &newmsgs, &oldmsgs);<BR>><<BR>>< time(&peer->lastmsgcheck);<BR>><<BR>>< /* Retur n now if it's the same thing we told them <BR>>last time */<BR>>< if (((newmsgs << 8) | (oldmsgs)) == <BR>>peer->lastmsgsent_switch[i]) {<BR>>< if (i==mbox_count)<BR>>< return 0;<BR>>< else<BR>>< continue;<BR>>< }<BR>><<BR>>< p = sip_alloc(NULL, NULL, 0);<BR>>< if (!p) {<BR>>< ast_log(LOG_WARNING, "Unable to build sip <BR>>pvt data for MWI\n");<BR>>< return -1;<BR>>< }<BR>>< strncpy(name, peer->name, sizeof(name) - 1);<BR>>< peer->lastmsgsent_switch[i] = ((newmsgs << 8) | (oldmsgs));<BR>>< if (create_addr(p, name)) {<BR>>< /*
Maybe they're not registered, etc. */<BR>>< sip_destroy(p);<BR>>< return 0;<BR>>< }<BR>>< /* Recalculate our side, and recalculate Call ID */<BR>>< if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip))<BR>>< memcpy(&p->ourip, &__ourip, sizeof(p->ourip));<BR>>< build_via(p, p->via, sizeof(p->via));<BR>>< build_callid(p->callid, sizeof(p->callid), p->ourip, <BR>>p->fromdomain);<BR>>< /* Here I call another Function to Build Proper to header */<BR>>< /* Sen d MWI */<BR>>< ast_set_flag(p, SIP_OUTGOING);<BR>><<BR>>< //Ujju Set the p->peername pointer to char to NULL <BR>>if its length is 0<BR>><<BR>>< if (!strlen(p->peername)){<BR>>< strncpy(p->peername, peer->name, sizeof(p->peername));<BR>>< }<BR>><<BR>><<BR>>< transmit_notify_to_softswitch_with_mwi(p, mbox[i], <BR>>newmsgs, oldmsgs);<BR>>< ;
sip_scheddestroy(p, 15000);<BR>>< }<BR>><<BR>><<BR>><<BR>>< return 0;<BR>><<BR>>< }<BR>><<BR>><<BR>><<BR>>8743,8750c8574<BR>>< /* Ujju Here we call function to separate all the mailboxes <BR>>if tohost ne NULL and<BR>>< then call the below func - sip_send_mwi_to_softswitch - <BR>>for each of those mailboxes */<BR>><<BR>>< if (strlen(peer->tohost) != 0){<BR>>< sip_send_mwi_to_softswitch(peer);<BR>>< return 0;<BR>>< }<BR>><<BR>>---<BR>>> /* Check for messages */<BR>><BR>><BR>><BR>>Do you Yahoo!?<BR>>Yahoo! Small Business - <BR>><HTTP: evt="31637/*http://smallbusiness.yahoo.com/resources/" us.rd.yahoo.com>Try <BR>>our new resources site!<BR>><BR>>_______________________________________________<BR>>Asterisk-Dev mailing list<BR>>Asterisk-Dev@lists.digium.com<BR>>http://lists.digium.com/mailman/listinfo/asterisk-dev<BR>>To
UNSUBSCRIBE or update options visit:<BR>> http://lists.digium.com/mailman/listinfo/asterisk-dev<BR><BR></BLOCKQUOTE><BR><BR><p>
                <hr size=1>Do you Yahoo!?<br>
Yahoo! Mail - 250MB free storage. <a href="http://us.rd.yahoo.com/evt=29915/*http://info.mail.yahoo.com/mail_250">Do more. Manage less.</a>