<html>
<body>
Sorry for the previous empty message, here are the contents that was
supposed to be inside...<br><br>
This looks like a great idea.&nbsp; 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.&nbsp; What happens if a static endpoint
is really just a SIP UA EP?&nbsp; 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.&nbsp; (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?&nbsp; How would this fit in with
your changes here?<br><br>
For example:<br><br>
exten =&gt; s,1,MWISet(SIP/1234,1001@office)&nbsp; ;set MWI for SIP/1234
to 1001@office&nbsp; <br><br>
exten =&gt; s,1,MWIClear(SIP/1234)&nbsp; ;remove all MWI setting for
SIP/1234<br><br>
exten =&gt; s,1,MWISet(SIP/1234,2222@softswitch,r)&nbsp; ; 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>
&nbsp;<br>
I followed the NOTIFY mechanism for sending MWI as per RFC 3842....<br>
&nbsp;<br>
&nbsp;<br>
---------------------------------------------------------------sip.conf---------------------------------------<br>
[10.1.1.1:5080]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //This
sofswitch uses port 5080 for VoiceMail...we do have to <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
explicitly mention the port here so that Asterisk does not loose it while
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sending NOTIFY to Softswitches..I found out that Asterisk does loose
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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 &lt;jtodd@loligo.com&gt;</i></b> wrote:
<dl>
<dd>This looks interesting. Can you provide a bit more detail and some 
<dd>other updates?<br>

<dd>1) Can you supply a diff on the sip.conf file that shows an example 
<dd>of your new method (comment the section out, and use several lines of 
<dd>comments to explain what the example does)<br>

<dd>2) On what softswitches is this known to work? I assume you've 
<dd>tested with SER, as a baseline?<br>

<dd>3) Have you signed a disclaimer with Digium?<br>

<dd>4) Can you submit this as an addition to bugs.digium.com so that it 
<dd>will be included in future Asterisk releases if it meets approval and 
<dd>functionality criteria (as nebulous as both of those are...)?<br>

<dd>JT<br>
<br>

<dd>At 11:05 AM -0700 on 4/14/05, Jay Ray wrote:
<dd>&gt;Hi All,
<dd>&gt;
<dd>&gt; I had proposed the changes to be able to support Asterisk 
<dd>&gt;VoiceMail for 3rd Party Softswitches. Here is what I have changed
o n 
<dd>&gt;Asterisk in chan_sip.c
<dd>&gt;
<dd>&gt;While in function sip_send_mwi_to_peer() . in case
peer-&gt;tohost has 
<dd>&gt;a value which means that its not a registered EP - but a static 
<dd>&gt;peer, I call another function called sip_send_mwi_to_softswitch() 
<dd>&gt;.....in which I separate the comma separated mailboxes defined in 
<dd>&gt;sip.conf for that peer. and send NOTIFY in a for loop for each of 
<dd>&gt;the Mailboxes....by calling another new function 
<dd>&gt; transmit_notify_to_softswitch_with_mwi()
<dd>&gt;
<dd>&gt;In transmit_notify_to_softswitch_with_mwi() , I populate the 
<dd>&gt;sip_pvt-&gt;username with the mailbox number (minus the mailbox 
<dd>&gt;context, if any)...so that the mailbox number gets added to the
&quot;TO&quot; 
<dd>&gt;header in the NOTIFY going out to that Softswitch...for the 
<dd>&gt;Softswitch to pass on the NOTIFY to the appropriate 
Endpoint....
<dd>&gt;
<dd>&gt;The DIFF is below, comments appreciated.......
<dd>&gt;
<dd>&gt;
<dd>&gt;
<dd>&gt;
<dd>&gt;[root@jerrylinux channels]# diff chan_sip.c.wrking1
chan_sip.c.orig
<dd>&gt;489,490d488
<dd>&gt;&lt; int *lastmsgsent_switch; /* maintaining last message 
<dd>&gt;sent for EPS on a Third Party Softswitch */
<dd>&gt;&lt;
<dd>&gt;1207c1205
<dd>&gt;&lt;
<dd>&gt;---
<dd>&gt;&gt;
<dd>&gt;1209d1206
<dd>&gt;&lt;
<dd>&gt;1212d1208
<dd>&gt;&lt;
<dd>&gt;3930,3932d3925
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;4217,4271d4209
<dd>&gt;&lt; /*--- transmit_notify_to_softswitch_with_mwi: Notify
Softswitch user of
<dd>&gt;&lt; messages waiting in voicemail ---*/
<dd>&gt;&lt; /* Notification works for Softswitch peers with mailbox=
definitions
<dd>&gt;&lt; * in sip.conf
<dd>&gt;&lt; * We use the SIP Event package message-summary
<dd>&gt;&lt; * MIME type defaults to
&quot;application/simple-message-summary&quot;;
<dd>&gt;&lt; */
<dd>&gt;&lt; static int transmit_notify_to_softswitch_with_mwi(struct
sip_pvt 
<dd>&gt;*p, char *mbox, int newmsgs, int oldmsgs)
<dd>&gt;&lt; {
<dd>&gt;&lt; struct sip_request req;
<dd>&gt;&lt; char tmp[256];
<dd>&gt;&lt; char tmp2[256];
<dd>&gt;&lt; char *tmp_mbox;
<dd>&gt;&lt; char clen[20];
<dd>&gt;&lt;
<dd>&gt;&lt; /* I will put the Mailbox Number - the part before the @
<dd>&gt;&lt; * in p-&gt;username, and then call initreqprep as
initreqprep
<dd>&gt;&lt; * looks for a p-&gt;username and puts it in TO Header
<dd>&gt;&lt; */
<dd>&gt;&lt;
<dd>&gt;&lt; tmp_mbox = (char*) calloc(strlen(mbox), sizeof(char));
<dd>&gt;&lt;
<dd>&gt;&lt; strncpy(tmp_mbox, mbox, strlen(mbox));
<dd>&gt;&lt;
<dd>&gt;&lt; tmp_mbox = strsep(&amp;tmp_mbox, &quot;@&quot;);
<dd>&gt;&lt;
<dd>&gt;&lt; strncpy(p-&gt;username, tmp_mbox, strlen(tmp_mbox));
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; initreqprep(&amp;req, p, &quot;NOTIFY&quot;, NULL);
<dd>&gt;&lt;
<dd>&gt;&lt; add_header(&amp;req, &quot;Event&quot;,
&quot;message-summary&quot;);
<dd>&gt;&lt; add_header(&amp;req, &quot;Content-Type&quot;,
default_notifymime);
<dd>&gt;&lt;
<dd>&gt;&lt; snprintf(tmp, sizeof(tmp), &quot;Messages-Waiting:
%s\r\n&quot;, 
<dd>&gt;ne wmsgs ? &quot;yes&quot; : &quot;no&quot;);
<dd>&gt;&lt; snprintf(tmp2, sizeof(tmp2), &quot;Voice-Message: %d/%d\r
\n&quot;, 
<dd>&gt;newmsgs, oldmsgs);
<dd>&gt;&lt; snprintf(clen, sizeof(clen), &quot;%d&quot;,
(int)(strlen(tmp) + 
<dd>&gt;strlen(tmp2)));
<dd>&gt;&lt; add_header(&amp;req, &quot;Content-Length&quot;, clen);
<dd>&gt;&lt; add_line(&amp;req, tmp);
<dd>&gt;&lt; add_line(&amp;req, tmp2);
<dd>&gt;&lt;
<dd>&gt;&lt; if (!p-&gt;initreq.headers) {
<dd>&gt;&lt; /* Use this as the basis */
<dd>&gt;&lt; copy_request(&amp;p-&gt;initreq, &amp;req);
<dd>&gt;&lt; parse(&amp;p-&gt;initreq);
<dd>&gt;&lt; if (sip_debug_test_pvt(p))
<dd>&gt;&lt; ast_verbose(&quot;%d headers, %d lines\n&quot;, 
<dd>&gt;p-&gt;initreq.headers, p-&gt;initreq.lines);
<dd>&gt;&lt; determine_firstline_parts(&amp;p-&gt;initreq);
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt; return send_request(p, &amp;req, 1, p-&gt;ocseq);
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;8628,8734d8565
<dd>&gt;&lt; //Ujju - sip_send_mwi_to_softswitch : Sending MWI to another
Softswitch.
<dd>&gt;&lt; static int sip_send_mwi_to_softswitch(struct sip_peer
*peer)
<dd>&gt;&lt; {
<dd>&gt;&lt; /* Checking for all the m alboxes configured for a
softswitch
<dd>&gt;&lt; and sending NOTIFY w/MWI for all */
<dd>&gt;&lt; struct sip_pvt *p;
<dd>&gt;&lt; char name[256] = &quot;&quot;;
<dd>&gt;&lt; int newmsgs, oldmsgs;
<dd>&gt;&lt;
<dd>&gt;&lt; if(peer-&gt;mailbox==NULL){
<dd>&gt;&lt; ast_log(LOG_WARNING, &quot;No Mailboxes defined in sip.conf
and 
<dd>&gt;voicemail.conf for this softswitch&quot;);
<dd>&gt;&lt; return 0;
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt; int i;
<dd>&gt;&lt; int mbox_count=0;
<dd>&gt;&lt; char *mbox[500]; /*Pointer to individual malboxes*/
<dd>&gt;&lt; char *tmp=NULL; /*Temp Pointer to individual mailboxes*/
<dd>&gt;&lt; char *mailboxes;/* storing full comma separated mailbox 
<dd>&gt;string here */
<dd>&gt;&lt;
<dd>&gt;&lt; mailboxes=(char
*)calloc(strlen(peer-&gt;mailbox),sizeof(char));
<dd>&gt;&lt;
<dd>&gt;&lt; strcpy(mailboxes,peer-&gt;mailbox);
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; tmp=strchr(mailboxes,',');
<dd>&gt;&lt; //**mbox=(char **)malloc(sizeof(char *)*256);
<dd>&gt;&lt; //This copies first Mailbox in mbox[0]
<dd>&gt;&lt; mbox[mbox_count]=mailboxes;
<dd>&gt;&lt; mbox[mbox_count]=strsep(&amp;mbox[mbox_count],
&quot;,&quot;);
<dd>&gt;&lt;
<dd>&gt;&lt; //This copies rest of the mailboxes in mbox[1, 2, 3......]
<dd>&gt;&lt; while(tmp!=NULL)
<dd>&gt;&lt; {
<dd>&gt;&lt; mbox_count++;
<dd>&gt;&lt; tmp+=1;
<dd>&gt;&lt; mbox[mbox_count]=(char*) calloc(strlen(tmp), 
sizeof(char));
<dd>&gt;&lt; strncpy(mbox[mbox_count],tmp, strlen(tmp));
<dd>&gt;&lt; mbox[mbox_count]=strsep(&amp;mbox[mbox_count],
&quot;,&quot;);
<dd>&gt;&lt; tmp=strchr(tmp,',');
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; /* Allocating memory for PTR to last msg for each mailbox 
<dd>&gt;for EPs on Softswitch */
<dd>&gt;&lt; if (peer-&gt;lastmsgsent_switch == NULL) {
<dd>&gt;&lt; peer-&gt;lastmsgsent_switch = (int *) 
<dd>&gt;calloc(mbox_count,sizeof(int));
<dd>&gt;&lt; for (i=0;i&lt;=mbox_count;i++)
<dd>&gt;&lt; peer-&gt;lastmsgsent_switch[i]=-1;
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; //Now looping through all the Mailboxes to send individual
Notify's
<dd>&gt;&lt; for(i=0;i&lt;=mbox_count;i++) {
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; ast_app_messagecount(mbox[i], &amp;newmsgs, &amp;oldmsgs);
<dd>&gt;&lt;
<dd>&gt;&lt; time(&amp;peer-&gt;lastmsgcheck);
<dd>&gt;&lt;
<dd>&gt;&lt; /* Retur n now if it's the same thing we told them 
<dd>&gt;last time */
<dd>&gt;&lt; if (((newmsgs &lt;&lt; 8) | (oldmsgs)) == 
<dd>&gt;peer-&gt;lastmsgsent_switch[i]) {
<dd>&gt;&lt; if (i==mbox_count)
<dd>&gt;&lt; return 0;
<dd>&gt;&lt; else
<dd>&gt;&lt; continue;
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt; p = sip_alloc(NULL, NULL, 0);
<dd>&gt;&lt; if (!p) {
<dd>&gt;&lt; ast_log(LOG_WARNING, &quot;Unable to build sip 
<dd>&gt;pvt data for MWI\n&quot;);
<dd>&gt;&lt; return -1;
<dd>&gt;&lt; }
<dd>&gt;&lt; strncpy(name, peer-&gt;name, sizeof(name) - 1);
<dd>&gt;&lt; peer-&gt;lastmsgsent_switch[i] = ((newmsgs &lt;&lt; 8) |
(oldmsgs));
<dd>&gt;&lt; if (create_addr(p, name)) {
<dd>&gt;&amp;lt
<dd>; /* Maybe they're not registered, etc. */
<dd>&gt;&lt; sip_destroy(p);
<dd>&gt;&lt; return 0;
<dd>&gt;&lt; }
<dd>&gt;&lt; /* Recalculate our side, and recalculate Call ID */
<dd>&gt;&lt; if
(ast_sip_ouraddrfor(&amp;p-&gt;sa.sin_addr,&amp;p-&gt;ourip))
<dd>&gt;&lt; memcpy(&amp;p-&gt;ourip, &amp;__ourip,
sizeof(p-&gt;ourip));
<dd>&gt;&lt; build_via(p, p-&gt;via, sizeof(p-&gt;via));
<dd>&gt;&lt; build_callid(p-&gt;callid, sizeof(p-&gt;callid),
p-&gt;ourip, 
<dd>&gt;p-&gt;fromdomain);
<dd>&gt;&lt; /* Here I call another Function to Build Proper to header
*/
<dd>&gt;&lt; /* Sen d MWI */
<dd>&gt;&lt; ast_set_flag(p, SIP_OUTGOING);
<dd>&gt;&lt;
<dd>&gt;&lt; //Ujju Set the p-&gt;peername pointer to char to NULL 
<dd>&gt;if its length is 0
<dd>&gt;&lt;
<dd>&gt;&lt; if (!strlen(p-&gt;peername)){
<dd>&gt;&lt; strncpy(p-&gt;peername, peer-&gt;name,
sizeof(p-&gt;peername));
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; transmit_notify_to_softswitch_with_mwi(p, mbox[i], 
<dd>&gt;newmsgs, oldmsgs);
<dd>&gt;&amp;l
<dd>t; ; sip_scheddestroy(p, 15000);
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt; return 0;
<dd>&gt;&lt;
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;&lt;
<dd>&gt;8743,8750c8574
<dd>&gt;&lt; /* Ujju Here we call function to separate all the mailboxes 
<dd>&gt;if tohost ne NULL and
<dd>&gt;&lt; then call the below func - sip_send_mwi_to_softswitch - 
<dd>&gt;for each of those mailboxes */
<dd>&gt;&lt;
<dd>&gt;&lt; if (strlen(peer-&gt;tohost) != 0){
<dd>&gt;&lt; sip_send_mwi_to_softswitch(peer);
<dd>&gt;&lt; return 0;
<dd>&gt;&lt; }
<dd>&gt;&lt;
<dd>&gt;---
<dd>&gt;&gt; /* Check for messages */
<dd>&gt;
<dd>&gt;
<dd>&gt;
<dd>&gt;Do you Yahoo!?
<dd>&gt;Yahoo! Small Business - 
<dd>&gt;Try 
<dd>&gt;our new resources site!
<dd>&gt;
<dd>&gt;_______________________________________________
<dd>&gt;Asterisk-Dev mailing list
<dd>&gt;Asterisk-Dev@lists.digium.com
<dd>&gt;<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" eudora="autourl">http://lists.digium.com/mailman/listinfo/asterisk-dev</a>
<dd>&gt;To UNSUBSCRIBE or update options visit:
<dd>&gt;
<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>
&nbsp;&nbsp;
<a href="http://lists.digium.com/mailman/listinfo/asterisk-dev" eudora="autourl">http://lists.digium.com/mailman/listinfo/asterisk-dev</a>
</blockquote></body>
</html>