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:612ast_func_read: Dangerous function DB read blocked
[2023-07-02 14:35:55] ERROR[200062][C-00000014]: pbx_functions.c:655ast_func_read2: Dangerous function DB read blocked
[2023-07-02 14:35:55] NOTICE[200062][C-00000014]: chan_sip.c:30836sip_request_call: Asked to get a channel without offering any format
[2023-07-02 14:35:55] NOTICE[200062][C-00000014]: app_dial.c:2709dial_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)
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
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.
Create a test pjsip extension, for example 102. Leave all settings at defaults, except for extension number (102) and Outbound CID, (for example +12125551212).
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.
Call *43 (echo test). If that doesn’t work properly, we’ll fix it.
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): 192.81.237.20,192.81.236.20
Trunk should show available. If not, report errors.
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 pastebin.com and post the link here.
Temporarily set the Inbound Route to go to ext. 102. Call in and test. If it doesn’t work, paste the log as above.
Try to call with JAIN. If it fails, paste the log as above.
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
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
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.