# Originate a call in Asterisk

**URL:** <https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037>\
**Category:** General\
**Created:** [8 July 2019 11:10 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037 "2019-07-08T11:10:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [8 July 2019 11:10 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/1 "2019-07-08T11:10:48Z")

</div>

Hi all,  
In my application I want to make a call using Asterisk AMI with the node-red-asterisk-ami-manager in my Grandstream PBX.  
The node status is connected and I receive events from the node, but when I try to send the "originate" action with all the parameters, I receive a RequestBadFormat event.  
The message I send to the node is sent in msg.payload with the following text:  
"action: Originate \ r \ n  
channel: PJSIP / 7000 \ r \ n  
context: from-internal \ r \ n  
exten: 205 \ r \ n  
priority: 1 \ r \ n  
timeout: 60000 \ r \ n".

Any ideas about the format of the actions?

Regards

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [8 July 2019 11:21 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/2 "2019-07-08T11:21:34Z")

</div>

are you sure it’s supposed to be a string with windows line endings?

Rather than an object?

---

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [8 July 2019 11:43 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/3 "2019-07-08T11:43:42Z")

</div>

I'm not sure since there is no information in the node.  
I will try to send an object.

---

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [8 July 2019 12:39 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/4 "2019-07-08T12:39:58Z")

</div>

Thanks **ukmoose** for the suggestion, I used an object and it Works.  
I have created an IVR on extension 7005 with a warning message and in case of receiving an event, an automatic call is made to extension 205.  
This is my object:  
msg.payload.action= "Originate"  
msg.payload.channel= "PJSIP/205"  
msg.payload.context= "from-internal"  
msg.payload.exten= "7005"  
msg.payload.priority= "1"  
msg.payload.timeout="60000"

---

<div class="post-metadata">

**Author:** ![andre\_x](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@andre\_x](https://discourse.nodered.org/u/andre_x)\
**Post date:** [14 July 2023 13:57 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/5 "2023-07-14T13:57:39Z")

</div>

I get the error _Extension does not exist_, while I know that the extension exits since is my phone.  
How can I troubleshoot this?

.

---

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [14 July 2023 15:59 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/6 "2023-07-14T15:59:12Z")

</div>

Hi Andre\_x,  
Can you try another command, for example CoreShowChannels?

---

<div class="post-metadata">

**Author:** ![andre\_x](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@andre\_x](https://discourse.nodered.org/u/andre_x)\
**Post date:** [14 July 2023 16:03 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/7 "2023-07-14T16:03:38Z")

</div>

I get a _Success_ response.

P.s. How do I get all the commands? Sorry, but I'm a complete newbie!

---

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [14 July 2023 16:29 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/8 "2023-07-14T16:29:28Z")

</div>

You can see the commands here [Asterisk 18 AMI Actions - Asterisk Project - Asterisk Project Wiki](https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+AMI+Actions)

---

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [14 July 2023 16:56 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/9 "2023-07-14T16:56:45Z")

</div>

The main parameters are channel and exten. Channel is the destination of the call and exten the source. in my case exten is the ivr number where the message is recorded.

---

<div class="post-metadata">

**Author:** ![andre\_x](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@andre\_x](https://discourse.nodered.org/u/andre_x)\
**Post date:** [16 July 2023 13:22 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/10 "2023-07-16T13:22:45Z")

</div>

In which form should the channel be?  
If I put my my number (my extension or my mobile number) I always get _Invalid channel_ or _Extension does not exist_, but all the extensions I'm trying exists...

---

<div class="post-metadata">

**Author:** ![fernandezjm](https://avatars.discourse-cdn.com/v4/letter/f/9f8e36/32.png) [@fernandezjm](https://discourse.nodered.org/u/fernandezjm)\
**Post date:** [17 July 2023 16:34 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/11 "2023-07-17T16:34:58Z")

</div>

In my case the channel is in the form msg.payload.channel= "PJSIP/205", where 205 is the destination number and PJSIP is the protocol. I have a Grandstream IP PBX and the extension 205 is declared.

I have declared the extensión 7005 as IVR, with the format msg.payload.exten= "7005".

---

<div class="post-metadata">

**Author:** ![andre\_x](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@andre\_x](https://discourse.nodered.org/u/andre_x)\
**Post date:** [18 July 2023 06:57 UTC](https://discourse.nodered.org/t/originate-a-call-in-asterisk/13037/12 "2023-07-18T06:57:04Z")

</div>

The extension is in the same way that I use it, I don't understand why it still says that it doesn't exist...mmm....
