<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I am trying to implement the callback feature of our old phone system.
This feature may go by a different name in asterisk?<br>
<br>
It worked as follows. If phone A called phone B and it was BUSY, you
press a button to enable a callback.<br>
User A is free to continue work or make other calls.<br>
What this meant is that when both phones became free, phone A would
ring, on answer it would call phone B automatically.<br>
<br>
Here is how I have tried to achieve this with asterisk.<br>
<br>
When A calls B and B is busy you get a menu, 1 to set callback and 2 to
leave voicemail.<br>
The set of the callback is done via AGI call to PHP script to set the
details in MySQL DB.<br>
<br>
On all call hangups I check to see if there is a pending Callback via
another AGI script.<br>
The script sets a couple of variables which I check in my Dialplan. If
there is a callback pending for the<br>
phone that just hung up, I need to check that the other phone involved&nbsp;
is FREE. This is what I can not get to work.<br>
<br>
I have tried ChanIsAvail which does not appear to work.<br>
I have hints setup for each SIP phone. Which would be perfect, however
it does not appear that you can check the HINT STATE in the dialplan.<br>
I have done plenty of googling and have found this <a
 href="http://bugs.digium.com/view.php?id=10635">http://bugs.digium.com/view.php?id=10635</a>
which appears that this kind of functionality was placed in 1.4.11.
(DEVICE_STATE(), EXTENSION_STATE())<br>
I have 1.4.21.2 and do not have these features.<br>
<br>
To continue with the rest of the feature. If the ChanIsAvail says all
is good. I then launch another AGI to write a CALLFILE and remove the
pending callback request from the DB.<br>
This all works if A is not busy when B finishes their call etc.<br>
<br>
I am sure that others have implemented this kind of feature. If you
could share your implementation or give me some pointers or even the
correct asterisk name so I can google and get the help I need, that
would be great.<br>
I am considering trying out 1.6 which should have these features,
however not sure if stability is going to be a problem.<br>
<br>
I have based my implantation based of a previous message to the list:<br>
<br>
<pre wrap="">On Tue, Jun 10, 2008 at 5:34 PM, Phil Knighton <a
 class="moz-txt-link-rfc2396E" href="mailto:phil.knighton@mjog.com">&lt;phil.knighton@mjog.com&gt;</a> wrote:
</pre>
<blockquote type="cite">
  <pre wrap=""><span class="moz-txt-citetags">&gt; </span>Hello
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>I'm looking for a way to do the following using my Asterisk system and Snom
<span class="moz-txt-citetags">&gt; </span>SIP phones...
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>Scenario:
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>Caller on Internal Phone 1 calls internal phone2.  Phone 2 is busy (or more
<span class="moz-txt-citetags">&gt; </span>accurately goes straight to voicemail).
<span class="moz-txt-citetags">&gt; </span>Caller on internal phone 1 can press a button / dial a code (explained in
<span class="moz-txt-citetags">&gt; </span>next step) and hangup
<span class="moz-txt-citetags">&gt; </span>When phone 2 is free, phone 1 rings and on answer dials phone 2
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>I was sure this was called "camping" - but all the camping stuff I can find,
<span class="moz-txt-citetags">&gt; </span>refers to the caller having to hang on the phone and wait.  Am I missing
<span class="moz-txt-citetags">&gt; </span>something?
<span class="moz-txt-citetags">&gt;</span>
<span class="moz-txt-citetags">&gt; </span>Anyone have a solution?
<span class="moz-txt-citetags">&gt;</span>
  </pre>
</blockquote>
<pre wrap=""><!---->
Quick solution that comes into mind:

Set(exten_copy = ${EXTEN});
Dial(SIP/${EXTEN})
if ("${DIALSTATUS}"="BUSY") {
  // prompt for camp
  Set(DB(camp/${EXTEN}/call_to)=${CALLERID(num));
}

h =&gt; {
  Set(call_to=${DB(camp/${exten_copy}/call_to)});
  if ("${call_to}"!="") {
    Set(DB(camp/${exten_copy}/call_to)=);
    System(call_to ${exten_copy} ${call_to});
  }
}

So, in case if phone2 is busy, store callerid of phone1 in database,
so when phone2 will hangup it will triger a script "call_to" which
however can originate call trough manager or call-file.

Of course you will need some additional handling in case if multiple
callers decide to camp, or diferent protocols are used, etc.

Regards,
Atis</pre>
&nbsp;<br>
<br>
Thanks in Advance for any help.<br>
<br>
Regards<br>
<div class="moz-signature"><br>
<title></title>
<div style="font-family: Verdana,Arial,sans-serif;"><strong>Daniel
Johnson</strong><br>
<font size="-2">Systems Administrator / Systems Development<br>
Scanning Systems Australia<br>
<br>
<img src="cid:part1.00000905.00030505@scanningsystems.com.au"
 alt="Scanning Systems Australia">
<br>
<br>
<strong>Office:</strong> +61 7 3387 5555<br>
<strong>Facsimile:</strong> +61 7 3387 5588<br>
<strong>E-mail:</strong> <a href="mailto:dan.j@scanningsystems.com.au">dan.j@scanningsystems.com.au</a><br>
<strong>Website:</strong> <a href="http://www.scanningsystems.com.au">http://www.scanningsystems.com.au</a></font><br>
</div>
</div>
</body>
</html>