SIP request: Asked to get a channel without offering any format

Hi everyone,

I want to connect to a SIP provider to make outbound call to US phone numbers from our existing platform and receive inbound call to DIDs. I tried to do that with JAIN SIP (java lib) but only the signal part was successful, I couldn’t stream audio through RTP somehow (audience just don’t hear any sound). So, I installed Asterisk 18 & FreePBX 15 as ultimate solution, but I can’t make any outbound call due to below error:

[2023-07-02 14:35:55] ERROR[200062][C-00000014]: pbx_functions.c:612 ast_func_read: Dangerous function DB read blocked
[2023-07-02 14:35:55] ERROR[200062][C-00000014]: pbx_functions.c:655 ast_func_read2: Dangerous function DB read blocked
[2023-07-02 14:35:55] NOTICE[200062][C-00000014]: chan_sip.c:30836 sip_request_call: Asked to get a channel without offering any format
[2023-07-02 14:35:55] NOTICE[200062][C-00000014]: app_dial.c:2709 dial_exec_full: Unable to create channel of type ‘SIP’ (cause 58 - Bearer capability not available)
== Everyone is busy/congested at this time (1:0/0/1)

  • I already created a SIP trunk like this:




  • I want that SIP trunk to handle all out/in calls then i created an outbound route with simple dial patterns:


  • I created an inbound route to the Extensions 102.

  • I sent the Originate Action as below (asterisk-java v3.39):

OriginateAction originateAction = new OriginateAction();

Could anyone help to identify what that error means?

Move to chan_pjsip to save yourself ongoing problems. ???

Suggest you take baby steps, get a sip phone (soft or hard).

Hi @dicko , thanks for your time on checking my issue.
I moved to PJSIP per your suggestion, here are my settings:

I also created new extensions PJSIP 101

Now it shows me this error

[2023-07-03 03:13:29] DEBUG[262787]: chan_pjsip.c:2696 chan_pjsip_request_with_stream_topology:  101 Topology:  <0:audio-0:audio:sendrecv (ulaw)>
[2023-07-03 03:13:29] DEBUG[248101]: chan_pjsip.c:2595 request:  101
[2023-07-03 03:13:29] DEBUG[248101]: res_pjsip_session.c:3330 ast_sip_session_create_outgoing:  101 (null) Topology:  <0:audio-0:audio:sendrecv (ulaw)>
[2023-07-03 03:13:29] ERROR[248101]: res_pjsip.c:852 ast_sip_create_dialog_uac: Endpoint '101': Could not create dialog to invalid URI '101'.  Is endpoint registered and reachable?
[2023-07-03 03:13:29] DEBUG[248101]: res_pjsip_session.c:3356 ast_sip_session_create_outgoing:  Couldn't create dialog
[2023-07-03 03:13:29] ERROR[248101]: chan_pjsip.c:2681 request: Failed to create outgoing session to endpoint '101'
[2023-07-03 03:13:29] DEBUG[248101]: chan_pjsip.c:2683 request:  Couldn't create session
[2023-07-03 03:13:29] DEBUG[262787]: chan_pjsip.c:2706 chan_pjsip_request_with_stream_topology:  Couldn't push task
[2023-07-03 03:13:29] DEBUG[262787]: channel_internal_api.c:701 ast_channel_nativeformats_set:  <initializing>: Formats: (none)
[2023-07-03 03:13:29] DEBUG[262787]: channel_internal_api.c:713 ast_channel_nativeformats_set:  Channel is being initialized or destroyed
[2023-07-03 03:13:29] DEBUG[262787]: stasis.c:580 stasis_topic_create_with_detail: Creating topic. name: channel:1688354009.53, detail: 
[2023-07-03 03:13:29] DEBUG[262787]: stasis.c:614 stasis_topic_create_with_detail: Topic 'channel:1688354009.53': 0x7f7880004be0 created
[2023-07-03 03:13:29] DEBUG[262787]: channel.c:949 __ast_channel_alloc_ap: Channel 0x7f7880002fc0 'OutgoingSpoolFailed' allocated

Additional info:
Screenshot 2023-07-03 at 12.25.29

freepbx*CLI> pjsip list endpoints

 Endpoint:  <Endpoint/CID.....................................>  <State.....>  <Channels.>

 Endpoint:  101/101                                              Unavailable   0 of inf
 Endpoint:  commio-trunk2                                        Not in use    0 of inf
 Endpoint:  dpma_endpoint                                        Unavailable   0 of inf

Objects found: 3

gõ hoặc dẫn code vào đây

what is extension 101 ?

gõ hoặc dẫn code vào đây ???

It’s a PJSIP extension to receive inbound call (generated by my java code) then forward to outbound through the SIP trunk.

Inbound route:

I guess it’s not working yet (unregistered) back to baby steps perhaps?

pjsip show endpoints

my SIP provider doesn’t require register, maybe that’s why the endpoint shows Unavailable?

We are talking here about your homegrown extension 101 , your commio-trunk2 is fine and unless you have commercial modules enabled and licensed and are deploying Sangoma/Digium phones, then why are you trying to use dpma ?
Again, you have a trunk working, but you need to ‘baby step’ an easy sip endpoint that just can ring and answer, after that you get to be a big boy after a bit more of RTFM.

As @dicko said, take it one step at a time:

  1. Create a test pjsip extension, for example 102. Leave all settings at defaults, except for extension number (102) and Outbound CID, (for example +12125551212).
  2. Configure an IP phone, ATA or softphone (Windows, Mac or Linux) for the test extension. I recommend against an Android or iOS app, as that makes troubleshooting more difficult. Using MicroSIP under Windows as an example, you need to set only four values: SIP Server (IP address of your PBX), Username (201), Domain (IP address of your PBX), and Password (same as Secret in FreePBX extension). Softphone should show Online. If not, we’ll troubleshoot that first.
  3. Call *43 (echo test). If that doesn’t work properly, we’ll fix it.
  4. Fix your trunk. Using Easily Interconnect Commio SIP Trunking And VitalPBX 4. Step-by-step Guide. as a guide:
    General tab looks fine. On the Advanced tab:
    Outbound Proxy: (leave blank)
    Contact User: (leave blank)
    From Domain: (leave blank)
    From User: (leave blank)
    Client URI: (leave blank)
    Server URI: (leave blank)
    AOR Contact: (leave blank)
    Match (Permit):,
  5. Trunk should show available. If not, report errors.
  6. Make an outgoing call (for example 18004377950). If it doesn’t work, at the Asterisk command prompt, type
    pjsip set logger on
    retry the call, paste the Asterisk log for the call at and post the link here.
  7. Temporarily set the Inbound Route to go to ext. 102. Call in and test. If it doesn’t work, paste the log as above.
  8. Try to call with JAIN. If it fails, paste the log as above.

Hi @Stewart1 , thanks for joining the topic.

I setup everything per your instructions and it seems everything works well:

  • Echo test: works, i can hear my own voice
  • Dial to US phone is being forwarded to 12125551212.

So i assume the issue is at my asterisk java code. In our business case, I want to handle all outbound/inbound calls behavior at our platform, I guess I can do that with an AGI script server?

You assume correctly, but your ‘business case’ needs more than ‘guessing’ , what is your concept of an ‘AGI script server’, generally AGI scripts don’t ‘serve’ anything, they can however react to the prevalent channel conditions

My business case is:

  • On incoming call:
  • Check if the call is valid (probably it calls to existing DID in our database)
  • Check preset condition to either
    → Forward it to a call center number
    → Play re-recorded audio
    → Hangup
  • On outbound call:
  • Ringless voicemail:
    → Dial 1st call → as soon as status is changed to ringing → Dial 2nd call to same destination → As soon as 2nd call is connected to voice mail → Hangup 1st call → Place a pre-recorded audio file to voicemail
    → Failover: If 1st call gets answered → Forward to a call center number → Skip dialing 2nd call

  • Normal: Dial a call → if it gets connected → play pre-recorded audio

We can implement all those behaviors at our platform, now i need somehow to listen and response to events from the call through the PBX

That is what ‘Asterisk Gateway Interface’ can do, there are libraries for many languages, some work better than others , or you can write your own code, but nobody here is going to write any code for you for free, so I suggest you roll your sleeves up and just do it :slight_smile:

Yes, we will implement that at our platform. I deployed a simple AGI script to a server eg:
agi://<agi server IP>/default.agi
How can i configure the FreePBX to send events of all inbound/outbound calls to that server?

FreePBX is not involved, it’s an asterisk thing, Asterisk will be sending and receiving all so filtered events on TCP:5038 by default to listening processes as previously defined in your ‘manager’ account setup.

Thanks all for your help. From now I will try to develop AGI script.

1 Like

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