AMI and MixMonitor not recording calls

I am newbie to Asterisk and learning using the book Asterisk; the Definitive guide…I have tried the AMI call using Telnet and PHP successfully.

telnet localhost 5038
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
Asterisk Call Manager/4.0.3
I originated the call successfully and it worked correctly.

Action: Originate
Channel: PJSIP/SOFTPHONE_A
Context: sets
Exten: 103
Priority: 1

The issue i face is regarding recording of calls, once it is originated…using MixMonitor.I tried the following:

Action: Originate
Channel: PJSIP/SOFTPHONE_A
Context: sets
Exten: 103
Priority: 1
Action: MixMonitor
Channel: PJSIP/SOFTPHONE_A
File: 12345.wav

The call connects, but no recording occurs and I cant hear the voice too in both soft phones…I am totally lost, being a newbie…What am i doing wrong ??

Channel in Originate is misnamed. It is really a dial string. You need to use the actual channel name, for the particular session. (Even with phones as the peer, there can be multiple concurrent channels. The channel names are the names you get from “core show channels” and against which events like NewChannel are reported.

Also AMI actions need to be separated by blank lines.

In this case, it may be better to originate to a local channel, and have the local channel dialplan enable the MixMonitor.

I think the dual meanings of Channel arose from DAHDI, and, in particular, analogue lines, where there is only ever one possible active channel associated with a dial string.

When i make a call with only Originate it is working fine and soft phone is ringing…I am using 000f30A0A01-00000000 instead of SOFTPHONE_A

Manager ‘hello’ logged on from 127.0.0.1
== Manager ‘hello’ logged off from 127.0.0.1
– Called 0000f30A0A01
– PJSIP/0000f30A0A01-00000000 is ringing

I tried using AMI actions separated by blank lines, without any result.
Originate to local channel, i am unable to understand with my current knowledge levels…being a beginner.

The documentation also refers to StopMixMonitor. Should we change permissions in var/spool/asterisk/monitor ??? Confused…

I changed the permission of /var/spool/asterisk/monitor to 755 and even tried 777…No recordings…I searched quite a lot online and in books without any result.

Action: Originate
Channel: PJSIP/0000f30A0A01
Context: sets
Exten: 101
Priority: 1
Async: yes

Action: MixMonitor
Channel: PJSIP/0000f30A0A01
File: 3000_27032013170512.wav

Action: StopMixMonitor
Channel: PJSIP/0000f30A0A01

These should be:

Where -00000000 will be different each time within a single run of Asterisk and should match the value in “– PJSIP/0000f30A0A01-00000000 is ringing”.

Also, please note that I would expect there to be an obvious “channel not found” type message in the logs with your current code.

1 Like

Thank you so much…It got recorded…

Yes, every time the call is appending new values:
PJSIP/0000f30A0A01-00000003 answered
– Executing [101@sets:1] Dial(“PJSIP/0000f30A0A01-00000003”, “PJSIP/0000f30B0B02”) in new stack
– Called PJSIP/0000f30B0B02
– PJSIP/0000f30B0B02-00000004 is ringing
– PJSIP/0000f30B0B02-00000004 is ringing
Why is it so ??? and How can we record in such a scenario ?? How do we track the appended numbers ??? Or can we prevent it ??

Look for the NewChannel event, or avoid the problem by setting up the MixMonitor in the dialplan.

Okay, i will try the Dial Plan…But it remains a mystery to me on how these values are getting appended ??
If we add to Dial Plan, is the only change required is change of context ??

It’s the way channel names are constructed. They have to be unique within the system as there may be multiple from the same endpoint at the same time.

1 Like

For SIP end points, you can create indefinitely large numbers of channels to the same end point (most hard phones allow at least two, and trunks can have large numbers. To distinguish between these, both chan_sip and chan_pjsip use channel names which contain a part to distinguish between different ones to the same device. You should consider the part that is appended as opaque. Currently, for chan_sip, it is a serial number. I think it used to be the address of the SIP specific data, but that caused problems because the same address could be re-used quite quickly, hence the current serial number.

For DAHDI analogue channels, there can only be one channel in existence, at any one time, for a given copper pair, so it isn’t necessary to add such a modifier. That’s not true for local channels, so they also have a modifier, although it obtained differently, and is in two parts.

As I said in my first reply, the use of Channel for Originate is misleading,and may be the result of its being created before Asterisk added VoIP support.

1 Like

Thank you for the detailed reply.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.