Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N
infamoose wrote:Mr. Florell,
sip.conf
- Code: Select all
; Sample /etc/asterisk/sip.conf
; File Version 080812
; Updated Jun 13, 2008 to fix inbound legacy calls
; Updated Jul 9, 2008 to migrate to sjc/jfk
; Updated Aug 8, 2008 to be more SIP RFC compliant
;
; Copyright (c) 2003-2008 VoicePulse Inc.
; VoicePulse is a registered trademark of VoicePulse Inc.
;
; =========================================================
; QUICKSTART WITH VOICEPULSE CONNECT FOR ASTERISK
;
; * Login to your VoicePulse for Business & Wholesale account:
; http://connect.voicepulse.com/
;
; * Go to the Credentials page to see your device login and
; device password. Your device login and passwords are
; NOT THE SAME AS YOUR WEBSITE LOGIN AND PASSWORD.
;
; * Do a text search & replace in this file:
; - Replace MY_DEVICE_LOGIN with your device login
; - Replace MY_DEVICE_PASSWORD with your device password
;
; =========================================================
; ---------------------------------------------------------
; GENERAL SETTINGS
;
; ---------------------------------------------------------
[general]
; .........................................................
; Handle unknown calls
; .........................................................
context=banned
; .........................................................
; REGISTER WITH VOICEPULSE
;
; You should register to the datacenter closest to you.
; There are currently two datacenters you may use:
; * New York, NY (JFK)
; * San Jose, CA (SJC)
;
; The entire "register =>" line below should be on one line
; (with no carriage returns in the middle):
; .........................................................
; Register to JFK by default
; West coast users should use sjc-primary and sjc-backup instead
register => XXXXXXXXX:XXXXXXXXX@sjc-primary.voicepulse.com ; Version 080812
register => XXXXXXXXX:XXXXXXXXX@jfk-backup.voicepulse.com ; Version 080812
; ---------------------------------------------------------
; SIP PEERS
;
; These are the primary and backup peers for calls to/from:
; JFK (New York, NY) or SJC (San Jose, CA)
; ---------------------------------------------------------
[voicepulse-primary] ; Version 080812
type=peer
context=voicepulse-in ; <-- the context in extensions.conf
; that you want these calls to go to
host=sjc-primary.voicepulse.com ; <-- west coast users should
; use sjc-primary instead
username=XXXXXXXXXXX
secret=XXXXXXXXXXX
qualify=yes
allow=all
canreinvite=no
dtmfmode=rfc2833
rfc2833compensate=yes
insecure=port,invite
trustrpid=yes
[voicepulse-backup] ; Version 080812
type=peer
context=voicepulse-in ; <-- the context in extensions.conf
; that you want these calls to go to
host=jfk-backup.voicepulse.com ; <-- west coast users should
; use sjc-backup instead
username=XXXXXXXXXX
secret=XXXXXXXXX
qualify=yes
allow=all
canreinvite=no
dtmfmode=rfc2833
rfc2833compensate=yes
insecure=port,invite
trustrpid=yes
; ---------------------------------------------------------
; REGISTERED USER -- FOR TESTING SIP ENDPOINTS
;
; This is a test user. You can use Counterpath's X-Lite
; Phone to test your Asterisk configuration. Configure the
; following settings:
;
; Menu > System Settings > Sip Proxy > [default]
;
; Enabled: Yes
; Display Name: sipuser
; User Name: sipuser
; Authorization User: sipuser
; Password: sippassword
; SIP Proxy: <your Asterisk server IP address>
;
; You can get X-Lite at:
; http://www.counterpath.com/
; ---------------------------------------------------------
[sipuser]
type=friend
host=dynamic
secret=sippassword
context=outgoing
canreinvite=no
allow=all
extensions.conf
- Code: Select all
; Sample /etc/asterisk/extensions.conf
; File Version 080812
; Created September 1, 2004
; Updated Jun 24, 2008 to fix bug with int'l calls
; Updated Jul 9, 2008 to support jfk/sjc
; Updated Aug 8, 2008 to reflect changes in sip.conf
;
; Copyright (c) 2003-2008 VoicePulse Inc.
; VoicePulse is a registered trademark of VoicePulse Inc.
;
; =========================================================
; QUICKSTART WITH VOICEPULSE CONNECT FOR ASTERISK
;
; * Login to your VoicePulse for Business & Wholesale account:
; http://connect.voicepulse.com/
;
; * Go to the API page to see your API key
;
; * Do a text search & replace in this file:
; - Replace MY_API_KEY with your API key
; - There should be 1 occurrence
; - Don't replace VOICEPULSE_API_KEY by mistake!
;
; * Test your incoming and outgoing calls using the test
; programs mentioned in sip.conf
;
; * Incoming calls should read back your number and any
; digits you press
;
; * After testing, modify the OUTGOING CONTEXT and
; INCOMING CONTEXT per your requirements.
;
; =========================================================
; ---------------------------------------------------------
; GENERAL SETTINGS
;
; ---------------------------------------------------------
[general]
static=yes
writeprotect=no
; ---------------------------------------------------------
; GLOBAL SETTINGS
;
; ---------------------------------------------------------
[globals]
; .........................................................
; API Settings
;
; MY_API_KEY is the key found in your Account Center.
;
; VOICEPULSE_API_PREFIX is to prevent naming conflicts
; between your own variables and the ones returned by the
; VoicePulse API. When you run an API macro, like
; [macro-voicepulseflexrate], it will set a number of local
; variables based on the response. These variable names
; will be prefixed with the VOICEPULSE_API_PREFIX that is
; defined below.
;
; To access the variables set by the API, you can refer to
; them by doing:
;
; ${VOICEPULSE_FLEXRATE}
;
; This is a variable "FLEXRATE" returned by the API and
; prefixed with "VOICEPULSE_" defined below.
;
; .........................................................
VOICEPULSE_API_KEY=LONGAPIKEYGOESHERE
VOICEPULSE_API_PREFIX=VOICEPULSE_
; .........................................................
; Peers
; .........................................................
VOICEPULSE_GATEWAY_OUT_A=voicepulse-primary
VOICEPULSE_GATEWAY_OUT_B=voicepulse-backup
; ---------------------------------------------------------
; VOICEPULSE FLEXRATE MACRO
;
; This macro will return realtime pricing so you may do
; your own least cost routing between VoicePulse and your
; other termination providers.
;
; To use this macro, use the following line in your
; outgoing context:
;
; exten => _XX.,n,Macro(voicepulseflexrate,${VOICEPULSE_API_KEY},${EXTEN})
;
; The macro will set the VOICEPULSE_FLEXRATE variable to
; a decimal value. Test the value of that variable against
; your other providers' flat rate value to determine if the
; VoicePulse rate is lower and where to send the call. One
; way to do this is using the GotoIf() command:
;
; exten => _XX.,n,GotoIf($[${VOICEPULSE_FLEXRATE} < 0.013]?outgoing|${EXTEN}|1:otheritsp-outgoing|${EXTEN}|1)
;
; This statement assumes you are using a provider with a
; flat $0.013 rate to the US. The statement checks if the
; VOICEPULSE_FLEXRATE is lower. If so, send the call through
; VoicePulse using the [outgoing] context (as configured
; in this sample file). Otherwise, send the call through
; some other ITSP using the [otheritsp-outgoing] context
; (which does not exist in this sample file).
;
; Copyright (c) 2008 V-o-i-c-e-P-u-l-s-e Inc.
;
; ---------------------------------------------------------
[macro-voicepulseflexrate]
exten => s,1,Set(${VOICEPULSE_API_PREFIX}FLEXRATE=999)
exten => s,2,Set(${VOICEPULSE_API_PREFIX}FLEX_RATE=999)
exten => s,n,Set(VoicePulsePostData=ApiKey=${ARG1}&PhoneNumber=${ARG2})
exten => s,n,Set(VoicePulseResponse=${CURL(https://connect.voicepulse.com/secure/services/Api0605.asmx/AstGetFlexRate|${VoicePulsePostData})})
exten => s,n,Macro(voicepulseparseresponse,${VoicePulseResponse})
[macro-voicepulseparseresponse]
exten => s,1,Set(VoicePulseTemp=${ARG1})
exten => s,n,Set(VoicePulseTemp=${CUT(VoicePulseTemp,>,2-)})
exten => s,n,Set(VoicePulseTemp=${CUT(VoicePulseTemp,>,2-)})
exten => s,n,Set(VoicePulseTemp=${CUT(VoicePulseTemp,<,1)})
exten => s,n,Set(VoicePulseCounter=${FIELDQTY(VoicePulseTemp,~)})
exten => s,n,While($[${VoicePulseCounter} > 0])
exten => s,n,Set(VoicePulsePair=${CUT(VoicePulseTemp,~,${VoicePulseCounter})})
exten => s,n,Set(VoicePulseKey=${CUT(VoicePulsePair,=,1)})
exten => s,n,Set(VoicePulseValue=${CUT(VoicePulsePair,=,2)})
exten => s,n,Set(${VOICEPULSE_API_PREFIX}${VoicePulseKey}=${VoicePulseValue})
exten => s,n,Set(VoicePulseCounter=$[${VoicePulseCounter}-1])
exten => s,n,EndWhile()
; ---------------------------------------------------------
; OUTGOING CONTEXT
;
; [outgoing] is the context referred to by the test user
; [sipuser] in sip.conf.
; This is where your custom outgoing call processing should
; go.
;
; Outgoing calls should be dialed in proper e164 format:
; +<countrycode><number>
;
; For example:
; +17323395100 or
; +441234567890
; ---------------------------------------------------------
[outgoing]
; .........................................................
; NANPA calls
; .........................................................
; Set your CallerID number
; Setting both the name and number is required due to
; non-standard SIP behavior by previous versions of Asterisk.
;
; The CallerID number must be a 10-digits.
exten => _1NXXNXXXXXX,1,Set(CALLERID(num)=0000000000)
exten => _1NXXNXXXXXX,2,Set(CALLERID(name)=0000000000)
; Print the SIP Call-ID to the CLI for troubleshooting.
; You can send this Call-ID to customer service when asked
; for a call example that may have experienced an issue.
exten => _1NXXNXXXXXX,n,NoOp(SIPCALLID: ${SIPCALLID})
; .........................................................
; LEAST COST ROUTING
;
; Uncommenting the lines below will:
; - Tell Asterisk that your non-VoicePulse flat rate for
; calls is $0.013
; - Look up the realtime rate VoicePulse will charge for
; this call
; - Print the rate to the Asterisk CLI
; - Check which rate is lower
; - If the non-VoicePulse rate is lower, it will send your
; call through the other provider
; - If the VoicePulse rate is lower, it will go to the next
; priority below and send the call through VoicePulse
;
; exten => _1NXXNXXXXXX,n,Set(OTHER_PROVIDERS_FLAT_RATE=0.013)
; exten => _1NXXNXXXXXX,n,Macro(voicepulseflexrate,${VOICEPULSE_API_KEY},${EXTEN})
; exten => _1NXXNXXXXXX,n,Verbose(The rate is ${VOICEPULSE_FLEXRATE})
; exten => _1NXXNXXXXXX,n,GotoIf($[${VOICEPULSE_FLEXRATE} > ${OTHER_PROVIDERS_FLAT_RATE}]?${EXTEN}|SomeOtherProvider)
; exten => _1NXXNXXXXXX,n(SomeOtherProvider),Dial(SIP/SomeOtherProvider)
; .........................................................
; Send your call to VoicePulse using SIP
; VoicePulse recommends using SIP due to its ability to
; separate signalling and media traffic, resulting in a more
; robust and reliable architecture. Using SIP will allow you
; to take full advantage of VoicePulse's various failover
; mechanisms now and in the future.
exten => _1NXXNXXXXXX,n,Dial(SIP/+${EXTEN}@${VOICEPULSE_GATEWAY_OUT_A})
exten => _1NXXNXXXXXX,n,GotoIf($[${DIALSTATUS}=CHANUNAVAIL]?${EXTEN}|GatewayB)
exten => _1NXXNXXXXXX,n(GatewayB),Dial(SIP/+${EXTEN}@${VOICEPULSE_GATEWAY_OUT_B})
; .........................................................
; International calls
; .........................................................
; Set your CallerID number
; The CallerID number must be a 10-digits.
exten => _011XXXX.,1,Set(CALLERID(num)=0000000000)
; Print the SIP Call-ID to the CLI for troubleshooting.
; You can send this Call-ID to customer service when asked
; for a call example that may have experienced an issue.
exten => _011XXXX.,n,NoOp(SIPCALLID: ${SIPCALLID})
; .........................................................
; LEAST COST ROUTING
;
; Uncommenting the lines below will:
; - Tell Asterisk that your non-VoicePulse flat rate for
; international calls is $0.50
; - Look up the realtime rate VoicePulse will charge for
; this call
; - Print the rate to the Asterisk CLI
; - Check which rate is lower
; - If the non-VoicePulse rate is lower, it will send your
; call through the other provider
; - If the VoicePulse rate is lower, it will go to the next
; priority below and send the call through VoicePulse
;
; exten => _011XXXX.,n,Set(OTHER_PROVIDERS_FLAT_RATE=0.50)
; exten => _011XXXX.,n,Macro(voicepulseflexrate,${VOICEPULSE_API_KEY},${EXTEN})
; exten => _011XXXX.,n,Verbose(The rate is ${VOICEPULSE_FLEXRATE})
; exten => _011XXXX.,n,GotoIf($[${VOICEPULSE_FLEXRATE} > ${OTHER_PROVIDERS_FLAT_RATE}]?${EXTEN}|SomeOtherProvider)
; exten => _011XXXX.,n(SomeOtherProvider),Dial(SIP/SomeOtherProvider)
; .........................................................
; Send your call to VoicePulse using SIP
; VoicePulse recommends using SIP due to its ability to
; separate signalling and media traffic, resulting in a more
; robust and reliable architecture. Using SIP will allow you
; to take full advantage of VoicePulse's various failover
; mechanisms now and in the future.
exten => _011XXXX.,n,Dial(SIP/+${EXTEN:3}@${VOICEPULSE_GATEWAY_OUT_A})
exten => _011XXXX.,n,GotoIf($[${DIALSTATUS}=CHANUNAVAIL]?${EXTEN}|GatewayB)
exten => _011XXXX.,n(GatewayB),Dial(SIP/+${EXTEN:3}@${VOICEPULSE_GATEWAY_OUT_B})
; ---------------------------------------------------------
; INCOMING CONTEXT
;
; [voicepulse-in] is the context referred to by the
; [voicepulse-primary] peer in sip.conf or the
; [voicepulse-backup] peer in sip.conf
;
; This is where your custom incoming call processing should
; go.
;
; IMPORTANT: Incoming calls from VoicePulse will have an
; extension of country code + number, so calls from US
; numbers will be 1 + area code + number (11 digits).
; ---------------------------------------------------------
[voicepulse-in]
; .........................................................
; This section catches calls coming from VoicePulse.
;
; The extension used below will catch your incoming calls
; regardless of what phone numbers are on your VoicePulse
; Connect for Asterisk account:
;
; exten => _XX.
;
; If you would like to route your calls based on different
; incoming phone numbers (YOUR numbers, not the caller's
; number), use:
;
; exten => _17325550000,1,Dial(SIP/sipuser)
; exten => _17325550001,1,Dial(SIP/john)
; ...
; ...
; ...
;
; Copyright (c) 2008 V-o-i-c-e-P-u-l-s-e Inc.
;
; For sample purposes, this section will ring your test
; SIP phone. For this to
; work:
; - You must have a test phone setup using the test user
; found at the end of sip.conf
; - You must order a phone number on your account
; - You must dial that phone number from a different phone
;
; .........................................................
exten => _XX.,1,NoOp(Call received from VoicePulse)
exten => _XX.,n,Dial(SIP/sipuser)
; ---------------------------------------------------------
; BANNED CONTEXT
;
; This context is used by unauthorized incoming or
; outgoing calls
; ---------------------------------------------------------
[banned]
exten => i,1,Hangup
exten => t,1,Hangup
mflorell wrote:Don't forget to have this before any "Dial" line:
exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
If it's not in there then ViciDial dialing will not work.
Users browsing this forum: Google [Bot] and 85 guests