Originate a callback!

Hi,
I want to ask something about the callback… Are there any commands to generate a call from Exten to Channel without to make a call back again to Exten ?
Example that I tried:

Action: Originate
Channel: Local/908xxxxxxxx@from-internal
Context: from-internal
Exten: 123
Priority: 1
Callerid: Soft dial:908xxxxxxxx
Timeout: 300000

This make a call to 908xxxxxxxx and when I pick up dial 123.

Dialplan requires a channel on which to run. An extension, in Asterisk, is a dialplan construct. Therefore you must have a channel before you can do anything with an extension.

What real world problem are you trying to solve?

Are you confusing an extension with an Asterisk device?

This appears to be a Support question.

Thanks for reply,
I’m new in Asterisk and …
I made connection and number in Exten make call to number in Channel , but when pick up this number rings this in Exten. just don’t want to make call back again to number in ‘Exten’.
I want to receive notification after dialing the client number in Channel, but not after making a connection.
Is there any way to do this?

as per your concern you want to run OBD so just try with this…

fputs($oSocket, “Action: login\r\n”);
fputs($oSocket, “Events: off\r\n”);
fputs($oSocket, “Username: xyz\r\n”);
fputs($oSocket, “Secret: xyz\r\n\r\n”);
fputs($oSocket, “Action: originate\r\n”);
fputs($oSocket, “Channel: DAHDI/g0/$MOBILENUMBER\r\n”);//replace g0 with your outgoing group and $MOBILENUMBER with phonenumber to be dialed
fputs($oSocket, “Context: ob1\r\n”);
fputs($oSocket, “Exten: _X.\r\n”);
fputs($oSocket, “Async: true\r\n”);
fputs($oSocket, “Priority: 1\r\n\r\n”);
fputs($oSocket, “Action: Logoff\r\n\r\n”);

and add the following to your dialplan

[testingob]
exten =>_X.,1,Dial(DAHDI/g0/${EXTEN},tT)

[ob1]
exten =>_X.,1,answer()
exten =>_X.,2,playback(hello-world)

good luck… :smile:

Hi [color=#000080]ajayteck[/color],
I made this things that you wrote me.
I put this
[color=#400000][testingob]
exten =>_X.,1,Dial(DAHDI/g0/${EXTEN},tT)

[ob1]
exten =>_X.,1,answer()
exten =>_X.,2,playback(hello-world)[/color]
in extensions.conf and the Response was Success but no connection with the number.
The Version of AMI is 1.1
Does it matter that?

change

fputs($oSocket, “Channel: DAHDI/g0/$MOBILENUMBER\r\n”);//replace g0 with your outgoing group and $MOBILENUMBER with phonenumber to be dialed

to

fputs($oSocket, “Channel: Local/$MOBILENUMBER@testingob\r\n”);

Do I have to change something in extensions.conf because I tried and no connection again?
I have to write in extensions.conf this

[testingob]
exten =>_X.,1,Dial(DAHDI/g0/${EXTEN},tT)

[ob1]
exten =>_X.,1,answer()
exten =>_X.,2,playback(hello-world)

or

[testingob]
exten =>_9.,1,Dial(DAHDI/g0/${EXTEN},tT)

[ob1]
exten =>_9.,1,answer()
exten =>_9.,2,playback(hello-world)
?
Thanks for reply!

Ok this is how we do it.

[code]//create a new socket
$sock = socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
//set timeout to 1 second
socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array(“sec” => 1, “usec” => 0));

socket_connect($sock,‘127.0.0.1’,5038);

$loginMessage = “Action: Login\r\nUsername: USERNAME\r\nSecret: PASSWORD\r\n\r\n”;

socket_write($sock,$loginMessage);

$authed = false;
while($line = @socket_read($sock, 255)) {
if(eregi(“Response: Success”,$line)){
$authed = true;
}
}
//if we are allowed to send commands to asterisk, then go
if($authed){
if($action == “dial” && isset($agent) && isset($destnum)){
//make the call
//tms bit
//

                            $reference = $_REQUEST['reference'];
                            $file = explode("_", $reference);
                            $datestamp = date(YmdHis , $file[2]);
                            $tmsfname = "$file[0]$datestamp";
                            $context = $_REQUEST['account'];
            //
            originate_call($sock,$agent,$context,$destnum,$tmsfname);
            //wait for a response
            $result = wait_for_response($sock);

//echo $result;
//break the result down into an array
$resArray = explode("\n",$result);
$tmpArr = split(":",$resArray[122]);
$tmpSIPArr = split(":",$resArray[128]);
[/code]

[code]//function to make a call
function originate_call(&$sock,$agent,$context,$destnum,$destname,$fname = NULL){
//
$reference = $REQUEST[‘reference’];
//bit to check if variable passed
if(isset($reference)){
// echo “$reference”;
}else{
$date = date(U);
$reference = "10000_001
$date";
// echo “$reference”;
}
//

//
$chancon = “click2call”;
$consuff = “click2callout”;
$file = explode(".", $reference);
$datestamp = date(YmdHis , $file[2]);
$tmsfname = “$file[0]”;
//
echo $context;
echo $tmsfname;
echo “Channel: Local/$agent@$context$chancon\r\n”;
echo “Context: $context$consuff\r\n”;
// echo “in the orinate”;
// echo “$tmsfname”;
$destname = ‘“Outbound” <’.$agent.’>’;
if(!$destname) $destname = $destnum;
$callStr = “Action: Originate\r\n”;
$callStr .= “Channel: Local/$agent@$context$chancon\r\n”;
$callStr .= “Exten: $destnum\r\n”;
$callStr .= “Priority: 1\r\n”;
$callStr .= “Async: True\r\n”;
$callStr .= “Context: $context$consuff\r\n”;
$callStr .= “CallerID: $destname\r\n”;
$callStr .= “Variable: tmsfile=$fname|dialer=yes|\r\n”;
$callStr .= “\r\n”;
socket_write($sock,$callStr);
}
socket_close($sock);
[/code]

I have to do this on C++ and I don’t understand your code but if you write me commands
I will be thankful because I’m trying in Telnet this after loggin:

Action: originate
Channel: DAHDI/111/0888888888
Context: ob1
Exten: _9.
Async: true
Priority: 1

I tried with Local and nothing

I’ve kept out of this because I suspect that there is a fundamental misunderstanding about Originate, somewhere, but I couldn’t work out what you are really trying to do.

However:

Exten: _9.

is definitely wrong, as Exten should be potential dialed digits, not a pattern to match them.

I tried with this and it works but I want to ring in one direction- from 123 at 908xxxxxxxx and when 908xxxxxxxx pick up then to make conversation

Action: Originate
Channel: Local/908xxxxxxxx@from-internal
Context: from-internal
Exten: 123
Priority: 1
Callerid: Soft dial:908xxxxxxxx
Timeout: 300000

Do you understand me now? :confused:

What you have will ring the long number. When it answers, it will ring the short number. Is that what you want?

If you want it to ring the short number first, simply reverse them.

If you want to do the former, but it is calling the short number before the long one has answered, you, or your ITSP has a problem with answer supervision, or the Local channel is calling Answer, explicitly or implicitly, before dialing the real target channel.

If you are not doing anything clever, it is simpler to specify the real target channel in the Originate. As we don’t know what the Local channel does, we can’t tell whether it is answering prematurely.