<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>RingRoost Blog &#187; SIP</title>
	<atom:link href="https://www.ringroost.com/blog/category/sip/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ringroost.com/blog</link>
	<description>RingRoost</description>
	<lastBuildDate>Tue, 11 Apr 2017 22:44:14 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1-alpha-30247</generator>
	<item>
		<title>Asterisk AMI &#8211; Sending MWI (Using SIPnotify)</title>
		<link>https://www.ringroost.com/blog/asterisk-ami-send-mwi-using-sip-notify/</link>
		<comments>https://www.ringroost.com/blog/asterisk-ami-send-mwi-using-sip-notify/#comments</comments>
		<pubDate>Sat, 17 Jan 2015 17:51:32 +0000</pubDate>
		<dc:creator><![CDATA[Taylor]]></dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[SIP]]></category>
		<category><![CDATA[VoIP]]></category>
		<category><![CDATA[ami]]></category>
		<category><![CDATA[asterisk ami]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[mwi]]></category>
		<category><![CDATA[sip]]></category>

		<guid isPermaLink="false">http://www.ringroost.com/blog/?p=86</guid>
		<description><![CDATA[Sending a SIP MWI (Message Waiting Indicator) using Asterisk AMI is possible, but the syntax is just really confusing (and not documented), after rummaging through the source code for a bit I worked it out. We need to use the SIPnotify AMI Action. The tricky part is getting the syntax right: Action: SIPnotify ActionID: 1231541512 &#8230; <a href="https://www.ringroost.com/blog/asterisk-ami-send-mwi-using-sip-notify/" class="more-link">Continue reading <span class="screen-reader-text">Asterisk AMI &#8211; Sending MWI (Using SIPnotify)</span></a>]]></description>
				<content:encoded><![CDATA[<p>Sending a SIP MWI (Message Waiting Indicator) using Asterisk AMI is possible, but the syntax is just really confusing (and not documented), after rummaging through the source code for a bit I worked it out.</p>
<p>We need to use the <a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerAction_SIPnotify" target="_blank">SIPnotify AMI Action</a>. The tricky part is getting the syntax right:</p>
<pre class="wp-code-highlight prettyprint">Action: SIPnotify
ActionID: 1231541512
Channel: peername
Variable: Event=message-summary,Content-Type=application/simple-message-summary,Content=Messages-Waiting: yes,Content=Voice-Message:1/3
</pre>
<div class="note">Notice: That that we need to set the the Variable argument &#8220;Content&#8221; in order to set the body, furthermore &#8220;Content&#8221; does not accept newlines &#8220;\n&#8221; so we have to set more than one &#8220;Content&#8221; &#8211; pretty confusing yes.</div>
<p>Here is a complete example of some PHP code that uses <a href="https://plus.google.com/113228277990041373338/posts" target="_blank">Joshua Hatfield&#8217;s</a> very helpful <a href="https://github.com/inetlms/lms/blob/master/lib/floAPI.php" target="_blank">flowAPI Class</a> which makes working with the Asterisk Manager Interface very easy in PHP.</p>
<pre class="wp-code-highlight prettyprint">        $username=&quot;somesippeerusername&quot;;
        $total_messages=5;
        $unheard_messages=2;
   
        $waiting=&quot;no&quot;;
        if($unheard_messages &amp;gt; 0){                                                                     
            $waiting=&quot;yes&quot;;                                                                            
        }                                                                                              
    
         $body1=&quot;Messages-Waiting: $waiting&quot;; 
         $body2=&quot;Voice-Message: $unheard_messages/$total_messages&quot;;
    
        $ami=new floAPI();                                                                           
        $params=array(
        &quot;ActionID&quot;=&amp;gt;rand(12,12),
        &quot;Channel&quot;=&amp;gt; $username,
        &quot;Variable&quot;=&amp;gt;&quot;Event=message-summary,Content-Type=application/simple-message-summary,Content=$body1,Content=$body2&quot;);
        
       $ami-&amp;gt;request(&quot;SIPnotify&quot;,$params);                                                             
       $ami-&amp;gt;close();

</pre>
<h2>Alternative ways of sending MWI</h2>
<p>You could use a different SIP messaging program (besides Asterisk) to send a SIP MWI Notify.</p>
<p>Using SipSak<br />
<a href="http://www.voip-info.org/wiki/view/Asterisk+Realtime+MWI+Hacks">http://www.voip-info.org/wiki/view/Asterisk+Realtime+MWI+Hacks</a></p>
<p>Using PHPSip<br />
<a href="https://code.google.com/p/php-sip/">https://code.google.com/p/php-sip/</a></p>
<p>Just make sure you use the right syntax as <a href="https://tools.ietf.org/html/rfc3842https://tools.ietf.org/html/rfc3842">specified here</a>.</p>
<div class="note">Note: For most Asterisk setups simply set &#8220;mailbox&#8221;in sip.conf and asterisk will send MWI behind the scene: <a href="http://www.voip-info.org/wiki/view/Asterisk+sip+mailbox">see here</a>. This is for those using VM outside of asterisk or have other custom needs.</div>
<div class="note"></div>
<div class="note">See also <a title="IVR Asterisk Set Up" href="https://www.ringroost.com/ivr-setup-asterisk.php">setting up an IVR in Asterisk</a> here.</div>
<div class="note"></div>
<p>References:<br />
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-13089?jql=text%20~%20%22SIPnotify%22">https://issues.asterisk.org/jira/browse/ASTERISK-13089?jql=text%20~%20%22SIPnotify%22</a><br />
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-23283?jql=text%20~%20%22SIPnotify%22">https://issues.asterisk.org/jira/browse/ASTERISK-23283?jql=text%20~%20%22SIPnotify%22</a><br />
<a href="http://forums.asterisk.org/viewtopic.php?f=1&amp;t=91498&amp;start=0&amp;hilit=SIPnotify">http://forums.asterisk.org/viewtopic.php?f=1&amp;t=91498&amp;start=0&amp;hilit=SIPnotify</a><br />
<a href="https://wiki.asterisk.org/wiki/display/AST/ManagerAction_SIPnotify">https://wiki.asterisk.org/wiki/display/AST/ManagerAction_SIPnotify</a></p>
]]></content:encoded>
			<wfw:commentRss>https://www.ringroost.com/blog/asterisk-ami-send-mwi-using-sip-notify/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
