Asterisk Originate (AMI vs Dialplan)

Hey

with AMIi do below, and i have early media:

Action: Originate
Channel: PJSIP/6001
Context: default
Exten: 999
Priority: 1
Callerid: 999
EarlyMedia: true
Codecs: ulaw,alaw,h264

The equivalent in Dialplan:

same => n,Originate(Local/6001@default,exten,default,999,1,,aC(ulaw,alaw,h264)c(999)n(1234))

No early media…

How can i define it in diaplan too with the originate app?

Thnx

The Originate dialplan application supports a subset. Early media is not supported.

ah ok, maybe i can execute the AMI from a dialplan then?

Not directly. If you execute something using AGI or System then yes.

something like:

same => n,System(/usr/sbin/asterisk -rx… ) ?

Something such as a script that connects over AMI to then execute whatever you want. There is no built-in way to do what you want directly.

ok, thnx

hey @jcolp

There is also this one it seems:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Application_UserEvent

I’m not sure what you’re referring to with that. It’s a dialplan application for producing AMI events.

ah, this one? to send an manager action ?

https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+ManagerAction_UserEvent

No. There is no dialplan application or function to send a manager action.

Hi, AGI is new to me, is that the same as “channel originate…” Command ?

Is it there also possible to define codecs/early media like i can define in in AMI ?

Not finding the correct info

AGI allows you to execute an external application. In that external application it’s up to you to do things. One of those things could be to connect to AMI and issue an Originate.

Ah ok, that’s indeed an approach, last question, I was looking at the REST API, instead of Ami…

In the query parameters, I don’t see an early media option either, is this only possible with Ami ?

Yes.

1 Like

Why is this not included in rest API or in Originate app, a particular reason?

Noone has done it.

1 Like

I’d suggest that even originate to dialplan is feature creep in ARI.

I would have argued that the fundamental operation is actually POST /channels/create, not POST /channels, and originate can be built from that. ARI is supposed to be a tool to provide low level operations, for application builders, not one to provide complete applications.

It looks to me as though what I think the OP is trying to do can be done starting from that, although if they don’t understand AGI calls AMI, I think they would struggle, and the AGI or System command calls AMI is probably easier for them to implement.

Guys, last question, if i do this:

Action: Originate
Channel: PJSIP/6001
Context: default
Exten: 999
Priority: 1
Callerid: 999
EarlyMedia: true
Codecs: ulaw,alaw,h264
Async: yes

Is it also possible at that when 6001 answers, he is joined into a Confbridge or Confbridge is created then ?

Tried like:


Action: Originate
Channel: PJSIP/6001
Context: default
Exten: 999
Application: Confbridge
Priority: 1
Callerid: 999
EarlyMedia: true
Codecs: ulaw,alaw,h264
Async: yes

But probably not correct syntaxt, i need to specify also the confbridge number?

ok, almost there, just 1 last question

This is my dialplan:

exten => 910,1,NoOp()
 same => n,Progress()
 ;same => n,Originate(PJSIP/6001,exten,default,999,1,,aC(ulaw,alaw,h264)c(999)n(Deurbel))
 same => n,Set(i=1)
 same => n,While($[${i} < 60])
 same => n,NoOp(Confbridge number of participants : ${CONFBRIDGE_INFO(parties,1)})
 same => n,GotoIf($["${CONFBRIDGE_INFO(parties,1)}" >= "1"]?startconf) 
 same => n,Wait(1) 
 same => n,Set(i=$[${i} + 1]
 same => n,EndWhile()
 same => n,Hangup() 
 same => n(startconf),ConfBridge(1,myconferenceroom,default_user)

When my intercom calls 910 , before i did an originate to invite user 6001 , but early media was not possible, so now where the line is commented, i do below AMI command

Action: Originate
Channel: Local/600@default
Context: default
Exten: 999
Priority: 1
Callerid: 999
EarlyMedia: true
Codecs: ulaw,alaw,h264
Async: yes

So i get al call coming on on PJSIP/6001… when i pickup, the Confbridge is stared, in above dialplan , i do a loop and i check if there are parties in conference, so when 6001 answers, the intercom joins the conf too

So 6001 gets the call from extension 999 , thats actually an RTSP video feed, also as early media!!

exten = 999,1,Answer()
 same => n,RTSP-SIP(rtsp://admin:Password01@192.168.0.70:554/Streaming/Channels/102,0,asterisk,5060)

exten => 600,1,NoOp()
 same => n,Progress()
 same => n,Dial(PJSIP/6001,,G(join_caller)) 
 same => n(join_caller),ConfBridge(1,myconferenceroom,marked_user)
 same => n(join_callee),ConfBridge(1,myconferenceroom,admin_user)

1 small issue remaining, how can i make sure extension 999 is with audio disabled? in my confbridge i have the setting for marked_user, that its muted, and also that only the marked_user needs to make video

[marked_user]

startmuted=yes

[myconferenceroom]

video_mode=first_marked