<DIV>Hi Chris,</DIV>
<DIV> </DIV>
<DIV> In case of a Static ENDPOINT which has multiple VM boxes defined in sip.conf, it will send a NOTIFY for each mailbox defined, which I think might not be a problem.</DIV>
<DIV> </DIV>
<DIV> However, if a Softswitch is registering with the Asterisk, then this wont work. Asterisk is desingned to aggregate all NEW and OLD msgs for a registering Endpoint/Softswitch and send them in on NOTIFY msg.</DIV>
<DIV> </DIV>
<DIV> The idea to put in an extra RemoteMailbox in sip.conf looks good. Going through the Asterisk Code and how if retireves Data from Files, i was a little confused as to how it actually gets info from the files like sip.conf.</DIV>
<DIV> </DIV>
<DIV> Here is how I would have to implement the remotemailbox thing....</DIV>
<DIV> </DIV>
<OL>
<LI> Add it to the sip_peer structure</LI>
<LI> make sure the FILE i/o operation reads that new variable (remotemailbox) from sip.conf.....(This I am not sure how to implement - Any pointers would help)</LI>
<LI>Use the remotemailbox in all the places that I am using mailbox currently in my new Functions..</LI></OL>
<DIV>Regarding your point of create MWI 's on the fly..can you explain what teh purpose for such a Feature would be.. I guess I missed your point....</DIV>
<DIV> </DIV>
<DIV>Thx,</DIV>
<DIV>J</DIV>
<DIV><BR><B><I>"Chris A. Icide" <chris@netgeeks.net></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">This looks like a great idea. However I've got some questions.<BR><BR>You indicate you are making some decision based upon whether or not an endpoint is registered or static. What happens if a static endpoint is really just a SIP UA EP? What happens if a softswitch you are serving as voicemail media for is registering with you instead of being static?<BR><BR>Would it work better if you added a special argument to the sip.conf?<BR><BR>instead of <BR><BR><A href="mailto:mailbox=12895551001@suppc5cm1,12895551002@suppc5cm1,12455551000@suppc5cm1">mailbox=12895551001@suppc5cm1,12895551002@suppc5cm1,12455551000@suppc5cm1</A><BR><BR>how about:<BR><BR>remotemailbox<A href="mailto:mailbox=12895551001@suppc5cm1,12895551002@suppc5cm1,12455551000@suppc5cm1">=12895551001@suppc5cm1,12895551002@suppc5cm1,12455551000@suppc5cm1</A><BR><BR>That way you leave the decision of whether or
not the host statement is static or dynamic to remain a functional decision versus a policy argument. (I could just be misunderstanding your detailed description as well)<BR><BR>On similar another note, I've been thinking about something I think would be valuable.<BR><BR><BR><BR>How difficult would it be to create a dialplan command that could assign, un-assign, etc. MWI pointers on the fly? How would this fit in with your changes here?<BR><BR>For example:<BR><BR>exten => s,1,MWISet(SIP/1234,1001@office) ;set MWI for SIP/1234 to 1001@office <BR><BR>exten => s,1,MWIClear(SIP/1234) ;remove all MWI setting for SIP/1234<BR><BR>exten => s,1,MWISet(SIP/1234,2222@softswitch,r) ; same as above except r options indicates this is a remote softswitch.<BR><BR><BR>-Chris<BR><BR><BR>On 12:45 PM 4/14/2005, Jay Ray wrote:<BR><BR>
<BLOCKQUOTE class=cite cite="" type="cite">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<BR> <BR>I followed the NOTIFY mechanism for sending MWI as per RFC 3842....<BR> <BR> <BR>---------------------------------------------------------------sip.conf---------------------------------------<BR>[10.1.1.1:5080] //This sofswitch uses port 5080 for VoiceMail...we do have to <BR> explicitly mention the port here so that Asterisk does not loose it while
<BR> sending NOTIFY to Softswitches..I found out that Asterisk does loose <BR> 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<BR>[10.1.1.2:5080]<BR>type=friend<BR>context=JerryC5_84<BR>dtmfmode=rfc2833<BR>host=10.1.1.2<BR><A
href="mailto:mailbox=15142550001@jerryc5vm">mailbox=15142550001@jerryc5vm</A><BR>allow=ulaw<BR>port=5080<BR>--------------------------------------------------------------------------------------------------------------------------------------------<BR><BR><BR><B><I>John Todd <jtodd@loligo.com></I></B> wrote:<BR>
<DL><BR>
<DD>This looks interesting. Can you provide a bit more detail and some <BR>
<DD>other updates?<BR><BR>
<DD>1) Can you supply a diff on the sip.conf file that shows an example <BR>
<DD>of your new method (comment the section out, and use several lines of <BR>
<DD>comments to explain what the example does)<BR><BR>
<DD>2) On what softswitches is this known to work? I assume you've <BR>
<DD>tested with SER, as a baseline?<BR><BR>
<DD>3) Have you signed a disclaimer with Digium?<BR><BR>
<DD>4) Can you submit this as an addition to bugs.digium.com so that it <BR>
<DD>will be included in future Asterisk releases if it meets approval and <BR>
<DD>functionality criteria (as nebulous as both of those are...)?<BR><BR>
<DD>JT<BR><BR><BR>
<DD>At 11:05 AM -0700 on 4/14/05, Jay Ray wrote:<BR>
<DD>>Hi All,<BR>
<DD>><BR>
<DD>> I had proposed the changes to be able to support Asterisk <BR>
<DD>>VoiceMail for 3rd Party Softswitches. Here is what I have changed o n <BR>
<DD>>Asterisk in chan_sip.c<BR>
<DD>><BR>
<DD>>While in function sip_send_mwi_to_peer() . in case peer->tohost has <BR>
<DD>>a value which means that its not a registered EP - but a static <BR>
<DD>>peer, I call another function called sip_send_mwi_to_softswitch() <BR>
<DD>>.....in which I separate the comma separated mailboxes defined in <BR>
<DD>>sip.conf for that peer. and send NOTIFY in a for loop for each of <BR>
<DD>>the Mailboxes....by calling another new function <BR>
<DD>> transmit_notify_to_softswitch_with_mwi()<BR>
<DD>><BR>
<DD>>In transmit_notify_to_softswitch_with_mwi() , I populate the <BR>
<DD>>sip_pvt->username with the mailbox number (minus the mailbox <BR>
<DD>>context, if any)...so that the mailbox number gets added to the "TO" <BR>
<DD>>header in the NOTIFY going out to that Softswitch...for the <BR>
<DD>>Softswitch to pass on the NOTIFY to the appropriate Endpoint....<BR>
<DD>><BR>
<DD>>The DIFF is below, comments appreciated.......<BR>
<DD>><BR>
<DD>><BR>
<DD>><BR>
<DD>><BR>
<DD>>[root@jerrylinux channels]# diff chan_sip.c.wrking1 chan_sip.c.orig<BR>
<DD>>489,490d488<BR>
<DD>>< int *lastmsgsent_switch; /* maintaining last message <BR>
<DD>>sent for EPS on a Third Party Softswitch */<BR>
<DD>><<BR>
<DD>>1207c1205<BR>
<DD>><<BR>
<DD>>---<BR>
<DD>>><BR>
<DD>>1209d1206<BR>
<DD>><<BR>
<DD>>1212d1208<BR>
<DD>><<BR>
<DD>>3930,3932d3925<BR>
<DD>><<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>4217,4271d4209<BR>
<DD>>< /*--- transmit_notify_to_softswitch_with_mwi: Notify Softswitch user of<BR>
<DD>>< messages waiting in voicemail ---*/<BR>
<DD>>< /* Notification works for Softswitch peers with mailbox= definitions<BR>
<DD>>< * in sip.conf<BR>
<DD>>< * We use the SIP Event package message-summary<BR>
<DD>>< * MIME type defaults to "application/simple-message-summary";<BR>
<DD>>< */<BR>
<DD>>< static int transmit_notify_to_softswitch_with_mwi(struct sip_pvt <BR>
<DD>>*p, char *mbox, int newmsgs, int oldmsgs)<BR>
<DD>>< {<BR>
<DD>>< struct sip_request req;<BR>
<DD>>< char tmp[256];<BR>
<DD>>< char tmp2[256];<BR>
<DD>>< char *tmp_mbox;<BR>
<DD>>< char clen[20];<BR>
<DD>><<BR>
<DD>>< /* I will put the Mailbox Number - the part before the @<BR>
<DD>>< * in p->username, and then call initreqprep as initreqprep<BR>
<DD>>< * looks for a p->username and puts it in TO Header<BR>
<DD>>< */<BR>
<DD>><<BR>
<DD>>< tmp_mbox = (char*) calloc(strlen(mbox), sizeof(char));<BR>
<DD>><<BR>
<DD>>< strncpy(tmp_mbox, mbox, strlen(mbox));<BR>
<DD>><<BR>
<DD>>< tmp_mbox = strsep(&tmp_mbox, "@");<BR>
<DD>><<BR>
<DD>>< strncpy(p->username, tmp_mbox, strlen(tmp_mbox));<BR>
<DD>><<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< initreqprep(&req, p, "NOTIFY", NULL);<BR>
<DD>><<BR>
<DD>>< add_header(&req, "Event", "message-summary");<BR>
<DD>>< add_header(&req, "Content-Type", default_notifymime);<BR>
<DD>><<BR>
<DD>>< snprintf(tmp, sizeof(tmp), "Messages-Waiting: %s\r\n", <BR>
<DD>>ne wmsgs ? "yes" : "no");<BR>
<DD>>< snprintf(tmp2, sizeof(tmp2), "Voice-Message: %d/%d\r \n", <BR>
<DD>>newmsgs, oldmsgs);<BR>
<DD>>< snprintf(clen, sizeof(clen), "%d", (int)(strlen(tmp) + <BR>
<DD>>strlen(tmp2)));<BR>
<DD>>< add_header(&req, "Content-Length", clen);<BR>
<DD>>< add_line(&req, tmp);<BR>
<DD>>< add_line(&req, tmp2);<BR>
<DD>><<BR>
<DD>>< if (!p->initreq.headers) {<BR>
<DD>>< /* Use this as the basis */<BR>
<DD>>< copy_request(&p->initreq, &req);<BR>
<DD>>< parse(&p->initreq);<BR>
<DD>>< if (sip_debug_test_pvt(p))<BR>
<DD>>< ast_verbose("%d headers, %d lines\n", <BR>
<DD>>p->initreq.headers, p->initreq.lines);<BR>
<DD>>< determine_firstline_parts(&p->initreq);<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>>< return send_request(p, &req, 1, p->ocseq);<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>8628,8734d8565<BR>
<DD>>< //Ujju - sip_send_mwi_to_softswitch : Sending MWI to another Softswitch.<BR>
<DD>>< static int sip_send_mwi_to_softswitch(struct sip_peer *peer)<BR>
<DD>>< {<BR>
<DD>>< /* Checking for all the m alboxes configured for a softswitch<BR>
<DD>>< and sending NOTIFY w/MWI for all */<BR>
<DD>>< struct sip_pvt *p;<BR>
<DD>>< char name[256] = "";<BR>
<DD>>< int newmsgs, oldmsgs;<BR>
<DD>><<BR>
<DD>>< if(peer->mailbox==NULL){<BR>
<DD>>< ast_log(LOG_WARNING, "No Mailboxes defined in sip.conf and <BR>
<DD>>voicemail.conf for this softswitch");<BR>
<DD>>< return 0;<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>>< int i;<BR>
<DD>>< int mbox_count=0;<BR>
<DD>>< char *mbox[500]; /*Pointer to individual malboxes*/<BR>
<DD>>< char *tmp=NULL; /*Temp Pointer to individual mailboxes*/<BR>
<DD>>< char *mailboxes;/* storing full comma separated mailbox <BR>
<DD>>string here */<BR>
<DD>><<BR>
<DD>>< mailboxes=(char *)calloc(strlen(peer->mailbox),sizeof(char));<BR>
<DD>><<BR>
<DD>>< strcpy(mailboxes,peer->mailbox);<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< tmp=strchr(mailboxes,',');<BR>
<DD>>< //**mbox=(char **)malloc(sizeof(char *)*256);<BR>
<DD>>< //This copies first Mailbox in mbox[0]<BR>
<DD>>< mbox[mbox_count]=mailboxes;<BR>
<DD>>< mbox[mbox_count]=strsep(&mbox[mbox_count], ",");<BR>
<DD>><<BR>
<DD>>< //This copies rest of the mailboxes in mbox[1, 2, 3......]<BR>
<DD>>< while(tmp!=NULL)<BR>
<DD>>< {<BR>
<DD>>< mbox_count++;<BR>
<DD>>< tmp+=1;<BR>
<DD>>< mbox[mbox_count]=(char*) calloc(strlen(tmp), sizeof(char));<BR>
<DD>>< strncpy(mbox[mbox_count],tmp, strlen(tmp));<BR>
<DD>>< mbox[mbox_count]=strsep(&mbox[mbox_count], ",");<BR>
<DD>>< tmp=strchr(tmp,',');<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< /* Allocating memory for PTR to last msg for each mailbox <BR>
<DD>>for EPs on Softswitch */<BR>
<DD>>< if (peer->lastmsgsent_switch == NULL) {<BR>
<DD>>< peer->lastmsgsent_switch = (int *) <BR>
<DD>>calloc(mbox_count,sizeof(int));<BR>
<DD>>< for (i=0;i<=mbox_count;i++)<BR>
<DD>>< peer->lastmsgsent_switch[i]=-1;<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< //Now looping through all the Mailboxes to send individual Notify's<BR>
<DD>>< for(i=0;i<=mbox_count;i++) {<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< ast_app_messagecount(mbox[i], &newmsgs, &oldmsgs);<BR>
<DD>><<BR>
<DD>>< time(&peer->lastmsgcheck);<BR>
<DD>><<BR>
<DD>>< /* Retur n now if it's the same thing we told them <BR>
<DD>>last time */<BR>
<DD>>< if (((newmsgs << 8) | (oldmsgs)) == <BR>
<DD>>peer->lastmsgsent_switch[i]) {<BR>
<DD>>< if (i==mbox_count)<BR>
<DD>>< return 0;<BR>
<DD>>< else<BR>
<DD>>< continue;<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>>< p = sip_alloc(NULL, NULL, 0);<BR>
<DD>>< if (!p) {<BR>
<DD>>< ast_log(LOG_WARNING, "Unable to build sip <BR>
<DD>>pvt data for MWI\n");<BR>
<DD>>< return -1;<BR>
<DD>>< }<BR>
<DD>>< strncpy(name, peer->name, sizeof(name) - 1);<BR>
<DD>>< peer->lastmsgsent_switch[i] = ((newmsgs << 8) | (oldmsgs));<BR>
<DD>>< if (create_addr(p, name)) {<BR>
<DD>>&lt<BR>
<DD>; /* Maybe they're not registered, etc. */<BR>
<DD>>< sip_destroy(p);<BR>
<DD>>< return 0;<BR>
<DD>>< }<BR>
<DD>>< /* Recalculate our side, and recalculate Call ID */<BR>
<DD>>< if (ast_sip_ouraddrfor(&p->sa.sin_addr,&p->ourip))<BR>
<DD>>< memcpy(&p->ourip, &__ourip, sizeof(p->ourip));<BR>
<DD>>< build_via(p, p->via, sizeof(p->via));<BR>
<DD>>< build_callid(p->callid, sizeof(p->callid), p->ourip, <BR>
<DD>>p->fromdomain);<BR>
<DD>>< /* Here I call another Function to Build Proper to header */<BR>
<DD>>< /* Sen d MWI */<BR>
<DD>>< ast_set_flag(p, SIP_OUTGOING);<BR>
<DD>><<BR>
<DD>>< //Ujju Set the p->peername pointer to char to NULL <BR>
<DD>>if its length is 0<BR>
<DD>><<BR>
<DD>>< if (!strlen(p->peername)){<BR>
<DD>>< strncpy(p->peername, peer->name, sizeof(p->peername));<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< transmit_notify_to_softswitch_with_mwi(p, mbox[i], <BR>
<DD>>newmsgs, oldmsgs);<BR>
<DD>>&l<BR>
<DD>t; ; sip_scheddestroy(p, 15000);<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>< return 0;<BR>
<DD>><<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>><<BR>
<DD>><<BR>
<DD>>8743,8750c8574<BR>
<DD>>< /* Ujju Here we call function to separate all the mailboxes <BR>
<DD>>if tohost ne NULL and<BR>
<DD>>< then call the below func - sip_send_mwi_to_softswitch - <BR>
<DD>>for each of those mailboxes */<BR>
<DD>><<BR>
<DD>>< if (strlen(peer->tohost) != 0){<BR>
<DD>>< sip_send_mwi_to_softswitch(peer);<BR>
<DD>>< return 0;<BR>
<DD>>< }<BR>
<DD>><<BR>
<DD>>---<BR>
<DD>>> /* Check for messages */<BR>
<DD>><BR>
<DD>><BR>
<DD>><BR>
<DD>>Do you Yahoo!?<BR>
<DD>>Yahoo! Small Business - <BR>
<DD>>Try <BR>
<DD>>our new resources site!<BR>
<DD>><BR>
<DD>>_______________________________________________<BR>
<DD>>Asterisk-Dev mailing list<BR>
<DD>>Asterisk-Dev@lists.digium.com<BR>
<DD>><A href="http://lists.digium.com/mailman/listinfo/asterisk-dev" eudora="autourl">http://lists.digium.com/mailman/listinfo/asterisk-dev</A><BR>
<DD>>To UNSUBSCRIBE or update options visit:<BR>
<DD>> <A href="http://lists.digium.com/mailman/listinfo/asterisk-dev" eudora="autourl">http://lists.digium.com/mailman/listinfo/asterisk-dev</A><BR><BR></DD></DL><BR><BR><BR>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> <BR>_______________________________________________<BR>Asterisk-Dev mailing list<BR>Asterisk-Dev@lists.digium.com<BR><A href="http://lists.digium.com/mailman/listinfo/asterisk-dev" eudora="autourl">http://lists.digium.com/mailman/listinfo/asterisk-dev</A><BR>To UNSUBSCRIBE or update options visit:<BR> <A href="http://lists.digium.com/mailman/listinfo/asterisk-dev" eudora="autourl">http://lists.digium.com/mailman/listinfo/asterisk-dev</A> </BLOCKQUOTE>_______________________________________________<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</BLOCKQUOTE><BR><BR><p>__________________________________________________<br>Do You Yahoo!?<br>Tired of spam? Yahoo! Mail has the best spam protection around <br>http://mail.yahoo.com