[asterisk-users] Parking calls

Atis Lezdins atis at iq-labs.net
Wed Dec 3 18:30:58 CST 2008


On Thu, Dec 4, 2008 at 1:25 AM, Sebastian <scgm at adinet.com.uy> wrote:
> I don't understand how can I solve my situation with this

Ok, a simplified sample (i used PHP because i use it daily, but any
language is good):

context incoming {
  _X. => {
    Answer();
    System(channel-waiting.php ${CHANNEL});
    MusicOnHold();
  }
}

context continue {
  _X. => {
    // you reached your condition
    Playback(tt-monkeys);
    Dial(SIP/something);
  }
}

then a channel-waiting.php would store ${CHANNEL} name somewhere in database.

Then, assuming you can execute some code WHEN you change the database
value you wanted to monitor in loop, you launch a script that sends
AMI Redirect action.

For example:

<?

$channel = 'SIP/123-abc'; // retrieved from DB where set by channel-waiting.php

require "phpagi-asmanager.php";
$as = new AGI_AsteriskManager();

$res=$as->connect("localhost","username","password");
if($res==FALSE) {
	echo "Connection failed.\n";
}

$res=$as->send_request("Redirect",
	array(
		"Channel"=>$channel,
		"Context"=>"continue",
		"Exten"=>"123",
		"Priority"=>"1"
		)
	);

if($as->resp_is_success($res)){
	echo "it worked!";
}
?>

>
>
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Atis Lezdins
> Sent: miércoles, 03 de diciembre de 2008 03:48 p.m.
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: Re: [asterisk-users] Parking calls
>
> On Wed, Dec 3, 2008 at 7:27 PM, Sebastian <scgm at adinet.com.uy> wrote:
>> The thing is I have to wait checking a database value to change the state,
>> that duration is not long, but on any case I don't know when will be ready
>> to go on.
>> If I use MusicOnHold app the dialplan get stuck there and there's no
> further
>> movement on my dialplan lines.
>> I will have a while loop checking for a database value to change, if it
>> changes the call will go on through the dialplan depending on the result,
>> but I can't make the call wait without any sound (I thought PlayTones
> could
>> be a possibility but I prefere MOH).
>> For these reasons I can't use a shell script launched in background.
>> Is there any way to launch in background some app like Background but
> follow
>> with the next dialplan line while it plays the sound??
>> (Just like Ringing does on my solution), I know making a local channel is
>> not the best solution, but at this moment I can't think on a different one
>> that not involves agi.
>>
>> Any idea??
>>
>>
>
> AMI action Redirect -
> http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Redirect
>
> Of course you would need some script to send this action, but as long
> as you control writes to database it shouldn't be a problem. All you
> need is to store ${CHANNEL} name of current channel before entering
> MusicOnHold().
>
> Also you could take a look at GROUP_COUNT function, perhaps it in some
> way can help you :)
>
> Regards,
> Atis
>
>
>
>
>
>
> --
> Atis Lezdins,
> VoIP Project Manager / Developer,
> IQ Labs Inc,
> atis at iq-labs.net
> Skype: atis.lezdins
> Cell Phone: +371 28806004
> Cell Phone: +1 800 7300689
> Work phone: +1 800 7502835
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
> __________ Information from ESET Smart Security, version of virus signature
> database 3660 (20081203) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
>
> __________ Information from ESET Smart Security, version of virus signature
> database 3662 (20081203) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
Atis Lezdins,
VoIP Project Manager / Developer,
IQ Labs Inc,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835



More information about the asterisk-users mailing list