<html>
<body>
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 type=cite class=cite 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>
</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></body>
</html>