An easy way to know if call is ringing

Is there some reasonably easy way to know if an outbound call placed to a SIP trunk from pyCall is being routed successfuly? Even some log file with reference number corresponding to that call is good enough.
As of now, I am unable to tell (unless I’m looking at CLI) if the call is successful unless it’s answered and then further handled by my dialplan.

Asterisk only understands SIP endpoints, not SIP trunks, and the same is true of the RFC.

We can only answer for Asterisk, not PyCall.

In general there is no way, not even from the log, as an alerting condition may not indicate that the destination is being rung, or may not happen, even if it is rung, also some destinations will generate ringback as early media. In fact, the main reason for not getting a prompt indication that a call has failed is that the failure is being signalled as early media, which increases the chances that the same applies to ringback.

If the signalling channel is being used, you can use AMI events. If it is not used, one of today’s other threads is asking about that case.

I see, while I was looking at the CLI I noticed that there are some errors visible, is it possible to at least catch those? Error such as: all circuits busy and similar ones.

I see messages.log but in there I see really abstract errors like

[Jun 9 21:14:02] NOTICE[14001] pbx_spool.c: Call failed to go through, reason (3) Remote end Ringing
[Jun 9 21:13:26] NOTICE[14287] pbx_spool.c: Call failed to go through, reason (8) Congestion (circuits busy)

without any, more specific identifier as to what call threw this, what was the callee’s number and so on, is there a way to perhaps enable more in depth logging so I can work with it?

You didn’t mention the use of call files.

You can use a local channel, rather than directly using the real device. That will give you access to DIALSTATUS and HANGUPCAUSE. The first message would, I believe, mean that the call timed out without a failure or being answered.

The number in square brackets is the thread ID, and I’d expect all messages for the same call attempt would have the same value.

I had a look at PyCall, and all that does is work indirectly, via call files. If you want more direct monitoring, you will have to do it via an AMI or ARI connection.

I assumed it was a phone. This would seem to be a PyCal question as PyCal is the constraining factor.

Thank you, that would be the solution in my case I presume from looking at GitHub - IVRTech/pystrix: pystrix is an attempt at creating a versatile Asterisk-interface package for AMI and (Fast)AGI needs. , I must ask though, is there any better established library for it? Apart from SeaSkirt

I wrote Seaskirt to

  • Cover all the Asterisk management APIs
  • Allow for SSL/TLS connections wherever Asterisk will accept them, and
  • Take advantage of Python’s asyncio architecture.

I am not aware of any other (public) API wrapper that offers all three.

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