<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
This <i>is</i> implemented in the Asterisk Dialplan.<br>
<br>
What we're doing is to write a custom "roaming extension" application
that (among other things) alters the mailbox that the device looks at
to set the MWI indicator to that of the "roaming" extension.&nbsp; All the
systems we sell have SIP peers stored in a realtime MySQL database.<br>
<br>
For example, roaming extension 109 logs on to the device on extension
900. (our client requires the device to always maintain it's own
extension number)&nbsp; As part of the login process, RealTimeUpdate is
called to update the mailbox watched by the device from 900 to 109.&nbsp;
While the update goes through fine, Asterisk itself has already cached
the mailbox number as a result of having rtcachefriends set to "yes" in
sip.conf.&nbsp; Of course, this is required for the MWI indicator to work
properly in the first place.<br>
<br>
The point that I'm using the system calls is to flush the cached device
details and reload them from MySQL.&nbsp; I can't see any way of doing this
through RealTimeUpdate or via any other application, so I'm left with
the manager commands to flush the entry, followed by a "sip show XXX
load" to re-cache the details.&nbsp; Works nicely, but it seems a bit ugly
to me.<br>
<br>
Frankly, I'm surprised that RealTimeUpdate doesn't contain an option to
flush and reload details, which would negate the need to employ other
"hacks" to achieve this.<br>
<br>
<br>
Atis Lezdins wrote:
<blockquote
 cite="mid:670f60170802120230k62807afu6a5de7d710974f5a@mail.gmail.com"
 type="cite">
  <pre wrap="">On 2/12/08, Rob Hillis <a class="moz-txt-link-rfc2396E" href="mailto:rob@hillis.dyndns.org">&lt;rob@hillis.dyndns.org&gt;</a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap=""> If this is the only real alternative, then in this instance I'll stick with
using the System command.  Writing an AGI to execute two manager commands in
this case is even greater overkill than using the System command.

 I understand that normally anything that calls multiple manager commands
would usually be something complex enough to justify an AGI.  The exception
seems to be when you're dealing with cached realtime data. (is it just me,
or does that sound like a rather odd oxymoron?)


 ast guy wrote:
 &gt; why don't you write an AGI which talks to asterisk manager API 5038 port
and executes the asterisk commands. You execute asterisk command via agi not
using system command
 &gt;
 &gt; -ag
 &gt;
 &gt; On Feb 11, 2008 11:24 AM, Rob Hillis &lt;<a class="moz-txt-link-abbreviated" href="mailto:rob@hillis.dyndns.org">rob@hillis.dyndns.org</a>
<a class="moz-txt-link-rfc2396E" href="mailto:rob@hillis.dyndns.org">&lt;mailto:rob@hillis.dyndns.org&gt;</a>&gt; wrote:
 &gt;

Hi guys,

 I've been working on a little dialplan fragment for roaming extensions,
 however the customer wants us to set the MWI indicator for the roaming
 extension that has just logged in.  We're using MySQL realtime, so I've
 figured out that RealTimeUpdate will happily update the realtime
 database with the correct mailbox.  My problem comes when I need to tell
 Asterisk to flush the realtime data for that extension and reload it so
 that the cached data is correct.  Running the commands "sip prune
 realtime peer XXX" followed by "sip show peer XXX load" work fine from
 the Asterisk manager interface and correctly update the cached data so
 the MWI indicator works fine.

 What I want to know is if there is any better method of running manager
 API commands from within the dialplan than the horribly ugly
 System(asterisk -rx "sip prune realtime peer XXX")  It works, but from
 my point of view, it's a somewhat nasty hack.

 Anyone have any suggestions?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
You could write dialplan application to do the same in chan_sip. Code
should be very simple, just the processing of one argument and reusing
existing functions. If you'll argument good enough why you need it, i
think it could be included in asterisk.

Regards,
Atis


  </pre>
</blockquote>
</body>
</html>