I try to realize this scheme – Call to mobile number via SIP thought asterisk originate command with dialplan.
I run command:
asterisk -rx "channel originate SIP/79887772211#sip extension 400#dialplan"
And my dialplan:
[dialplan]
exten => 400,1,Answer()
exten => 400,3,Playback(hello-world)
exten => 400,4,Hangup
Now, When I run command I got call on number 79887772211 and when I answer I hear hello world audio.
Now I want to add recall if number 79887772211 is now answer.
I try:
[dialplan]
exten => 400,1,Answer()
exten => 400,3,RetryDial(hello-world|5|3|SIP/79887772211#sip|5|d)
exten => 400,3,Playback(hello-world)
exten => 400,4,Hangup
But it doesn’t work =(
What I do wrong?
UPDATE
I change my dialplan to this:
[outbound]
exten=>_x.,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN}#sip,25) ;trunk to use
same=>n,RetryDial(hello-world|5|3:SIP/${EXTEN}#sip|5|d)
exten=>_xxx,1,verbose( calling to ${EXTEN})
same=>n,Set(CALLERID(num)=${calleridnumber}) ;callerid to use
same=>n,Dial(SIP/${EXTEN},25)
[play]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(demo-thanks)
same=>n,MusicOnHold(default)
same=>n,Hangup()
And now I can run command:
asterisk -x "channel originate Local/79887772211#outbound extension s#play"
and call works, bit if I drop call, asterisk doesn’t recall me.
Why RetryDial not works?
SOLUTION:
I edit dialplan and now its works =)
[play]
exten=>s,1,Noop(///${caller}///)
same=>n,Answer()
same=n,Playback(demo-thanks)
same=>n,MusicOnHold(default)
same=>n,Hangup()
[outbound3]
exten => _x.,1,Dial(SIP/${EXTEN}#sip,15,t)
exten => _x.,n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial1)
exten => _x.,n(redial1),Dial(SIP/${EXTEN}#sip,15,t)
same => n,Set(secondary=79001112233)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial2)
same => n(redial2),Dial(SIP/${EXTEN}#sip,15,t)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial3)
same => n(redial3),Dial(SIP/${secondary}#sip,15,t)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial4)
same => n(redial4),Dial(SIP/${secondary}#sip,15,t)
same => n,GotoIf($["${DIALSTATUS}"!="ANSWER"]?redial5)
same => n(redial5),Dial(SIP/${secondary}#sip,15,t)
I use command originate to run it, and everything fine:
channel originate Local/791114442233#outbound3 extension s#play
or run it via ARI:
curl -v -u admin:admin -X POST "http://127.0.0.1:8085/ari/channels?endpoint=Local/791114442233#outbound3&extension=s&context=play"
pro-sip*CLI> core show application Originate
-= Info about application 'Originate' =-
[Synopsis]
Originate a call.
[Description]
This application originates an outbound call and connects it to a specified
extension or application. This application will block until the outgoing call
fails or gets answered. At that point, this application will exit with the
status variable set and dialplan processing will continue.
This application sets the following channel variable before exiting:
${ORIGINATE_STATUS}: This indicates the result of the call origination.
FAILED
SUCCESS
BUSY
CONGESTION
HANGUP
RINGING
UNKNOWN: In practice, you should never see this value. Please report it to
the issue tracker if you ever see it.
[Syntax]
Originate(tech_data,type,arg1[,arg2[,arg3[,timeout]]])
[Arguments]
tech_data
Channel technology and data for creating the outbound channel.
For example, SIP/1234.
type
This should be 'app' or 'exten', depending on whether the outbound channel
should be connected to an application or extension.
arg1
If the type is 'app', then this is the application name. If the type is
'exten', then this is the context that the channel will be sent to.
arg2
If the type is 'app', then this is the data passed as arguments to the
application. If the type is 'exten', then this is the extension that the
channel will be sent to.
arg3
If the type is 'exten', then this is the priority that the channel is sent
to. If the type is 'app', then this parameter is ignored.
timeout
Timeout in seconds. Default is 30 seconds.
Related
I'm using asterisk 13, and testing call transfer by 'transfer' agent to agent. Agent 191 in call.
Agent-ID Name State Channel Talking with
191 atendente.virtual9 INUSE SIP/6039-00000019 Local/003230514418#from-internal-00000034;1
the call will be transferred to Agent 109.
same => n,Transfer(Local/109);
Transfer Status Return is
-- Executing [s#macro-transfer:6] NoOp("Local/003230514418#from-internal-0000002d;1", "UNSUPPORTED") in new stack
Is the form being used using the transfer correct?
in version 12 I was using 'AgentRequest'
exten => _ZX.,1,NoOp(AGENTE ${EXTEN});
same => n,Set(TIMEINI=${EPOCH});
same => n,AgentRequest(${EXTEN});
same => n,NoOp(AGENT_STATUS is ${AGENT_STATUS});
same => n,Hangup();
But the version 13 agent that transferred was kept busy and prevented from receiving a new connection until the transfer ended, so I am trying to use the 'transfer' command.
You have channel of type sip(most likly).
But you are transfering to
same => n,Transfer(Local/109);
Channel of type local. Transfer of sip to DIFFERNT channel type is not posible for technical reason. Local channel not support transfer at all as far as i know.
I have two phone numbers registered with the same sip provider. I would like Asterisk/PJSIP to route phone #1 (18005551212) differently than phone #2 (18005551313).
[sipprovider-18005551212]
type=registration
client_uri=sip:18005551212#sip.provider.com:5060
[sipprovider-18005551313]
type=registration
client_uri=sip:18005551313#sip.provider.com:5060
The Contact provided by Asterisk during registration is the same for both (using default extension 's').
Contact: <sip:s#10.1.1.1:5060>;expires=120
Can I do any of the following:
1) When registering, provide an extension other than 's'? Allowing inbound calls to hit unique extensions in the dialplan.
2) Route to unique context based on the To: Header on the INVITE? (which holds the unique phone number called). I have tried using 'context=' in the pjsip.conf endpoint block, but no luck; routing is either by IP (which is the same for both phone numbers), or by name (which is based on the From: Header).
Any help or pointers would be appreciated.
You could try this from my extensions.conf
[inbound-sip]
exten => 3215445,1,Goto(sip-in-1,s,1)
exten => 2544221,1,Goto(sip-in-2,s,1)
[sip-in-1]
exten => s,1,Goto(internal-ext,6881,1)
Calls then end up in the relevant context for further processing and alerting etc. sip-in-1 or sip-in-2 in this case.
In your sip.conf or pjsip.conf you need to specify the inbound context for both numbers you have - in this case context = inbound-sip
You should enable sip debug and see if calls have anything like destination number.
If it have no - you have no way get info which not present.
If you have, you should create extension s and parse number info using SIP_HEADER function from sip request body.
I'm using Asterisk 13 and building a PBX application controller to Call Centers. I'm facing a issue when handling agents, for some reason, Asterisk 13 doesnt have the channel type Agent enabled by default, so I don't know how to do to add an Agent on a queue member.
[May 17 02:03:58] WARNING[1767][C-00000001]: channel.c:5932 ast_request: No channel type registered for 'Agent'
There is anyway to enable Channel Type Agent on Asterisk 13? The member i'm testing is configured like that on queue.conf:
member => Agent/marcioantonio,0,Márcio Antônio,Agent:marcioantonio,no
And to login I just use the following AMI:
Action: Originate
Channel: Local/2000#login-agent
Application: AgentLogin
Data: marcioantonio,s
CallerID: OdinPBX Login Agent
Variable: login=marcioantonio
Note: The Variable is just for logging prupose. And here is the Dialplan of login-agent context:
[login-agent]
exten => _[0-9a-zA-Z].,1,NoOp(Trying to log agent ${login} on ${EXTEN})
same => n,Dial(Local/${EXTEN}#extensions)
After many tries, I found a way without Channel Type Agent. The trick is to use AgentRequest(AgentId) function on dialplan. So after changing my dialplan to:
[login-agent]
exten => _[0-9a-zA-Z].,1,NoOp(Trying to log agent ${login} on ${EXTEN})
same => n,Dial(Local/${EXTEN}#extensions)
[agents]
exten => _[0-9a-zA-Z].,1,NoOp(Connecting the current call to agent ${EXTEN})
same => n,AgentRequest(${EXTEN})
same => n,Hangup()
And the member on queue.conf:
member => Local/marcioantonio#agents,0,Márcio Antônio,Agent:marcioantonio,no
The queue and agents are working fine!
Márcio Antônio (Local/marcioantonio#agents from Agent:marcioantonio) (ringinuse disabled) (Not in use) has taken 5 calls (last was 346 secs ago)
Hope this help someone else!
I could not connect oracle with cakephp2, After search a few hour i found and followed link step by step still not success, my oracle 11g
error:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
I found solution with many errors, here what i fixed:
(Note still follow this link)
Error with php version 5.4.+ ,p 5.3.0 (wamp server)
Error with oracle php file file with override function (method not compatible )
Error connect database config
Error SELECT * FROM your table name [don't use select * that will work]
How to fix:
If still php 5.3.0 enable module oci8
Use this oracle file database i have been modified
in Cakephp Config database.php use
public $dboracle = array(
'datasource' => 'Database/Oracle',
'driver' => 'oracle',
'connect' => 'oci_connect',
'persistent' => true,
'host' => "your host database ip",
'login' => 'db user name',
'password' => 'db password',
'database' => '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=you db ip )(PORT=1521))
(CONNECT_DATA=(SID= you sid)))',
'prefix' => '',
'schema' => 'schema_name'
);
First, the ORA error is a permutation of the ORA-12514: TNS listener cannot resolve service name error as shown below. This form of the ORA-12541 error commonly happens when the database or the listener processes are in the middle of a startup, or when the database (mysid in your case) has not been registered with the listener.
root> oerr ora 12514
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Cause:
The listener received a request to establish a connection to a
database or other service.
The connect descriptor received by the listener specified a service
name for a service (usually a database service) that either has not
yet dynamically registered with the listener or has not been
statically configured for the listener.
This may be a temporary condition such as after the listener has
started, but before the database instance has registered with the
listener.
Action:
Wait a moment and try to connect a second time.
Check which services are currently known by the listener by
executing: lsnrctl services
Check that the SERVICE_NAME parameter in the connect descriptor of
the net service name used specifies a service known by the listener.
If an easy connect naming connect identifier was used, check that the service name specified is a service known by the listener.
Check for an event in the listener.log file.
Using ther Asterisk API I can redirect the To channel to an extension with or without a context.
If I try to redirect the From channel to an extension, the call is terminated unless the context is set to "default".
Why is this?
See also these questions about context and Asterisk.
Why would originate call fail when using the Asterisk API with the Context set to "default"?
https://stackoverflow.com/questions/10860456/why-would-redirect-fail-when-using-the-asterisk-api-to-call-an-outside-line
I believe you must specify the context at all times.
In a working example I use:
fputs($socket, "Action: Redirect\r\n");
fputs($socket, "ActionID: $actionID\r\n");
fputs($socket, "Channel: $channel\r\n");
fputs($socket, "Context: agents\r\n");
fputs($socket, "Exten: customHangup\r\n");
fputs($socket, "Priority: 1\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n"); // Log off
(Note that this is PHP sending to socket)
No need to specify the Channel:, Context:, Exten: and Priority:
In my experience, I think actually the redirection not forwarding or transferring a channel to one extension. Its actually redirecting the sequence of dialplan execution. So by redirecting you have to specify destination context,extension,priority. So that the redirected call take the appropriate call and execute. Unless you specify the context the it may take the default one. If no matching found I think it may disconnected. I think this may be happen to you. It may be identified from the asterisk CLI. I have one another problem when redirecting form one to another context first forwarding extensions hangup only arrive after complete conversation including forwarded extension.
my dialplan as follows:
[forwarding]
;callforwarding
exten => _XXXX,1,Answer()
same => n,Dial(SIP/${EXTEN})
same => n,Hangup()
[external]
exten => _XXXX,1,Answer()
same => n,Dial(SIP/${EXTEN})
same => n,Hangup()
AMI redirect action(php):
$msg="Action: Redirect\r\n";
$msg.="Exten: $ToExten\r\n";
$msg.="Context: forwarding\r\n";
$msg.="Priority: 1\r\n";
$msg.="Channel: $channel\r\n\r\n";
fputs($this->amisocket, $msg);
My issue: Hangup not receiving in time asterisk ami