Outbound call to sip server - sip trunking

Hello All.

I’ve bought a virtual number (DID) to a proveider and I can make call from an analog number to that DID and gets the call to an extension on my PBX which running on Asterisk.

This is the sip.conf code

[trunk] 
host=sip.netelip.com
defaultuser=xxxxxx
secret=xxxxxxx
type=friend
disallow=all
allow=alaw
allow=ulaw
allow=g722
allow=gsm
context=users
insecure=port,invite
qualify=15000

And this is the extensions.conf

exten => _X.,1,Dial(SIP/trunk,30)
exten => _X.,n,Dial(SIP/julian, 30)

What I want to do is from any extension call to a number a take out the call through the DID. But that is not working.
The second lines is when someone makes a call to that DID, SIP/julian rings and that works fine!

How I must configure the outbound call?

Thanks in advance and best regards.

What’s the configuration for your SIP Endpoints? You should add something like below in a context defined in your SIP endpoints.

Assuming the context is from_internal then add below in your extensions.conf
[from_internal]
exten => _X.,1, NoOP(Call from ${CALLERID(num)} to ${EXTEN})
same => n, DIal(SIP/trunk/${EXTEN},60)

type=friend is a security risk and I suggest you properly understand the security mechanism before you setup your Asterisk based system with external connectivity.

–Satish Barot

1 Like

Thanks.

Whats must goes in CALLERID(num)? and in ${EXTEN}?

best regards.

CALLERID(num) will be the numeric caller ID received on the channel and EXTEN will be the current extension.

1 Like

I believe you have just started working with Asterisk and I suggest to go through this book (based on old version of Asterisk but still really good to understand Asterisk and its components) and Asterisk wiki