Asterisk outgoing call fails with 'Busy Here' error - centos

I have Asterisk 11.7.0 configured on CentOS 6.4 x64 with following sip.conf configuration:
[general]
register =>myuser:pass#voipproviderip
registertimeout=20
context=incoming
allowoverlap=no
bindport=5060
bindaddr=192.168.0.3
srvlookup=no
subscribecontext=from-sip
[VoIPProvider]
canreinvite=yes
username=myuser
fromuser=myuser
secret=mypass
context=incoming
type=friend
;fromdomain=voipproviderip
host=voipproviderip
dtmfmode=rfc2833
disallow=all
allow=alaw
allow=ulaw
nat=yes
insecure=very
; ext 100
[100]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=100#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 101
[101]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=101#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 102
[102]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=102#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 103
[103]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=103#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 104
[104]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=104#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 105
[105]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=105#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 106
[106]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=106#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 100
[107]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=107#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
; ext 108
[108]
type=friend
host=dynamic
secret=MyPass123
context=default
mailbox=108#default
callgroup=1
pickupgroup=1
dtmfmode=rfc2833
canreinvite=no
and following extensions.conf:
[default]
include => internal
include => incoming
include => outgoing
[incoming]
; Ring on extension 100, 200 and the mobile phone.
exten => s,1,Answer()
exten => s,n,Dial(SIP/101&SIP/103,30,r,t,)
; Pass unanswered call to a mobile phone
exten => s,n,Dial(SIP/101&SIP/103/&SIP/100,30,r)
same => n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
same => n(unavail),VoiceMail(100#default,u)
same => n,Hangup()
same => n(busy),VoiceMail(100#default,b)
same => n,Hangup()
[outgoing]
; Outbound calls can be routed based on the number of digits dialled (or the value of the first few digits)
;exten=> _XXXXXXXXXXXX.,1,Dial(SIP/VoIPProvider/${EXTEN})
;exten=> _XXXXXXXXXXXX.,2,Hangup
exten => _XXXXXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
exten => _XXXXXXX,1,Dial(SIP/VoIPProvider/${EXTEN})
[internal]
; Calls between employees (between extensions)
exten => _XXX,1,Dial(SIP/${EXTEN},60)
include => outgoing
; Calls to ext 100
exten => 100,1,Dial(SIP/100,20)
exten => 100,n,VoiceMail(100,u)
exten => 100,n,Hangup
; Calls to ext 101
exten => 101,1,Dial(SIP/101,20)
exten => 101,n,VoiceMail(101,u)
exten => 101,n,Hangup
; Calls to ext 102
exten => 102,1,Dial(SIP/102,20)
exten => 102,n,VoiceMail(102,u)
exten => 102,n,Hangup
; Calls to ext 103
exten => 103,1,Dial(SIP/103,20)
exten => 103,n,VoiceMail(103,u)
exten => 103,n,Hangup
; Calls to ext 104
exten => 104,1,Dial(SIP/104,20)
exten => 104,n,VoiceMail(104,u)
exten => 104,n,Hangup
; Calls to ext 105
exten => 105,1,Dial(SIP/105,20)
exten => 105,n,VoiceMail(105,u)
exten => 105,n,Hangup
; Calls to ext 106
exten => 106,1,Dial(SIP/106,20)
exten => 106,n,VoiceMail(106,u)
exten => 106,n,Hangup
; Calls to ext 107
exten => 107,1,Dial(SIP/107,20)
exten => 107,n,VoiceMail(107,u)
exten => 107,n,Hangup
; Calls to ext 108
exten => 108,1,Dial(SIP/108,20)
exten => 108,n,VoiceMail(108,u)
exten => 108,n,Hangup
Whenever I dial a number from CLI>console dial mynumber, I see the folowing output:
-- Executing [mynumber#default:1] Dial("Console/dsp", "SIP/VoIPProvider/mynumber") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/VoIPProvider/mynumber
-- Got SIP response 486 "Busy Here" back from voipproviderip:5060
-- SIP/VoIPProvider-00000000 is busy
== Everyone is busy/congested at this time (1:1/0/0)
-- Auto fallthrough, channel 'Console/dsp' status is 'BUSY'
I have tried all the possible ways to dial a number, (including / excluding country code, etc.) but it always replays with 486 "Busy Here" could it be that I have to pay the bill of my voip service?

I would try Dial(SIP/mynumber#VoIPProvider);
Also, what do see when you do sip show peers ???

Related

PayPal DoReferenceTransaction bug when charging specific amount of 100.10

Unfortunately I can't get a response from PayPal tech support via their ticket system so maybe someone else has seen this. I'm certain it's a bug. Here are two API calls:
This one worked successfully:
[USER] => ***
[PWD] => ***
[SIGNATURE] => ***
[VERSION] => 86
[METHOD] => DoReferenceTransaction
[AMT] => 101.10
[TAXAMT] => 0.00
[ITEMAMT] => 101.10
[CURRENCYCODE] => USD
[PAYMENTACTION] => SALE
[REFERENCEID] => ***
[DESC] => ***
And this one didn't (only difference is the amount):
[USER] => ***
[PWD] => ***
[SIGNATURE] => ***
[VERSION] => 86
[METHOD] => DoReferenceTransaction
[AMT] => 100.10
[TAXAMT] => 0.00
[ITEMAMT] => 100.10
[CURRENCYCODE] => USD
[PAYMENTACTION] => SALE
[REFERENCEID] => ***
[DESC] => ***
The error returned for the second one is this:
[TIMESTAMP] => 2017-06-20T19:10:03Z
[CORRELATIONID] => ff77dc0fdff4e
[ACK] => Failure
[VERSION] => 86
[BUILD] => 29297572
[L_ERRORCODE0] => 10010
[L_SHORTMESSAGE0] => Invalid Invoice
[L_LONGMESSAGE0] => Non-ASCII invoice id is not supported
[L_SEVERITYCODE0] => Error
Clearly the error is also nothing to do with the problem as I'm even submitting an invoice id. Basically any amount other than 100.10 seems to work.
What's even more strange is that amount matches the PayPal error code that gets returned!
This is all in using the Sandbox.
Many thanks!
It sounds like you have negative testing enabled in the sandbox account, which allows you to force errors so that you test them by passing in an AMT that matches the error code you want to trigger. See the link for more details on this including how to enable/disable it.

PayPal DoCapture in Sandbox fails with 10609 error - Invalid TransactionID

Paypal's Sandbox API responds to a DoCapture with "Invalid TransactionID" error code 10609. The same operation works correctly in the PayPal live site. I think there might be some deprecated params that are rejected in the Sandbox, but accepted in the PayPal live site.
The ff. is POST data from IPN:
[mc_gross] => 1.05
[auth_exp] => 05:28:33 May 26, 2016 PDT
[protection_eligibility] => Ineligible
[payer_id] => SCBNBBCFDWQ54
[tax] => 0.00
[payment_date] => 05:28:33 Apr 26, 2016 PDT
[payment_status] => Pending
[charset] => windows-1252
[first_name] => SandboxStephen
[option_selection1] => Lc1tCoAwCAbgu3iCxtYHdpghtEKoUc2IEd09G_ulPq8oYYtPwh7hSuH0PMGYlMCYbrB_r8kUaK2JRXCuqc7JLzzLPxmEogPCcVEUllzZlKq-U95CFL-QhJtyPagb-ub9AA,,~7634f
[transaction_entity] => auth
[option_selection2] => VU7LDgIhEPuX-QACw_CavfoHxjPZAAdNBLO4h43x3wXjxfYybZNOVyZ-dUaG6wOWzooYnBZIQSiDQqH8upphvbe9PmMtJZcMS2YlpJF_ICLpA8rgR2DRqsFABq11qK1Gr9D82tK-baWmI6aWy3wxvMv5NC83tvR4661OJRlgeX8A~97b17
[option_selection3] => S7QytKoutjK3UspNLS5OTE9Vsi62MrBSUrKuBQA,~2c5b4
[option_selection4] => S7QytqoutjK3UkrPTCuJL8lXsi62MrBSAlGWUMG0ovxcJGFDA6h4am5iZg5cohYA~2aa63
[notify_version] => 3.8
[custom] =>
[payer_status] => verified
[business] => xxxxxxx#xxxxx
[quantity] => 1
[verify_sign] => AvzodxdQ1l47jbnC5iCE7iEjAVYEAnMT6fQE9TdHnShf4zX8V6L99Kpe
[payer_email] => xxxxxx#xxxx
[option_name1] => Transkey
[parent_txn_id] =>
[option_name2] => Syskey
[option_name3] => Message
[option_name4] => Gift
[txn_id] => 4R146799GX924083N
[payment_type] => instant
[remaining_settle] => 10
[auth_id] => 4R146799GX924083N
[last_name] => xxxxx
[receiver_email] => xxxxxxx#xxxxx
[auth_amount] => 1.05
[shipping_discount] => 0.00
[insurance_amount] => 0.00
[receiver_id] => F3XAHZBJYATHU
[pending_reason] => authorization
[txn_type] => web_accept
[item_name] => Test New Deal 2 (Topic)
[discount] => 0.00
[mc_currency] => USD
[item_number] =>
[residence_country] => US
[test_ipn] => 1
[shipping_method] => Default
[handling_amount] => 0.00
[transaction_subject] =>
[payment_gross] => 1.05
[auth_status] => Pending
[shipping] => 0.00
[ipn_track_id] => ff07a74b6ad10
The ff. are parameters for DoCapture:
[authorization_id] => 4R146799GX924083N
[amount] => 1.05
[invoice_id] => 9569
[currency] => USD
[CompleteCodeType] => Complete
[note] => Acuerdo de pago
The ff. is PayPal's response to DoCapture:
[AUTHORIZATIONID] => 4R146799GX924083N
[TIMESTAMP] => 2016-04-26T12:28:57Z
[CORRELATIONID] => 82d81683c3cc8
[ACK] => Failure
[VERSION] => 62
[BUILD] => 21669447
[L_ERRORCODE0] => 10609
[L_SHORTMESSAGE0] => Invalid transactionID.
[L_LONGMESSAGE0] => Transaction id is invalid.
[L_SEVERITYCODE0] => Error
I have tested the new PayPal security upgrades on the site and they work correctly. I specify a very old version (62) of the API, so that might be the problem, but I don't see what I need to change to get the Sandbox to work correctly.
Thanks.
It looks like you mix up the sandbox environment and live environment. You call DoCapture in the live environment, but the 4R146799GX924083N transaction is generated in sandbox environment.
When you call Docapture API, please make sure the API endpoint is https://api-3t.sandbox.paypal.com/nvp , the endpoint change to sandbox , not live.

Paypal IPN keeps failing - The totals of the cart item amounts do not match order amounts

We are using Woocommerce and Woocommerce Subscriptions. For some reason by default, Woocommerce Subscriptions (Reference Transactions) do not pass or include the Tax amount to Paypal. So I ended up modifying the class files and added in the field "TAXAMT" in the IPN.
However, when I did so, it is now giving us the error:
[L_ERRORCODE0] => 10413
[L_ERRORCODE1] => 10004
[L_SHORTMESSAGE0] => Transaction refused because of an invalid argument. See additional error messages for details.
[L_SHORTMESSAGE1] => Invalid Data
[L_LONGMESSAGE0] => The totals of the cart item amounts do not match order amounts.
[L_LONGMESSAGE1] => This transaction cannot be processed.
[L_SEVERITYCODE0] => Error
[L_SEVERITYCODE1] => Error
Can anybody please help me identify what's missing or what is wrong here?
Below is the IPN request sent to paypal (via woocommerce paypal logs)
This is a recurring product. The product costs $7.70 and the Tax is $0.77 with a total of $8.47
[USER] => ****************
[PWD] => ****************
[SIGNATURE] => ********************************************************
[VERSION] => 124
[METHOD] => DoReferenceTransaction
[REFERENCEID] => B-4CR65046J0487452E
[BUTTONSOURCE] => WooThemes_Cart
[RETURNFMFDETAILS] => 1
[AMT] => 7.70
[CURRENCYCODE] => AUD
[INVNUM] => WC-5184
[PAYMENTACTION] => Sale
[NOTIFYURL] => https://affgo.co/go/wc-api/WC_Gateway_Paypal/
[CUSTOM] => {"order_id":5184,"order_key":"wc_order_56bad2660bf0f"}
[TAXAMT] => 0.77
[ITEMAMT] => 8.47
[L_PAYMENTREQUEST_0_NAME0] => Subscriptions → IMMag Monthly
[L_PAYMENTREQUEST_0_AMT0] => 7.70
[L_PAYMENTREQUEST_0_QTY0] => 1
[PAYMENTREQUEST_0_ITEMAMT] => 7.70
[PAYMENTREQUEST_0_SHIPPINGAMT] => 0.00
[PAYMENTREQUEST_0_TAXAMT] => 0.77

Originate from a Label within a Macro

How can I originate a call from a label within a macro?
I know this isn't right, but I'm not sure how to work the call viking line into the origination cmd.
The last two lines of the macro comprise what I want to happen in place of "Local/callviking#...".
[macro-Paginator]
exten => s,1,Answer()
exten => s,n,System(asterisk -rx "channel originate Local/callviking#${MACRO_CONTEXT}/n extension ${ARG1}#soundeffects")
exten => s,n,Hangup()
exten => s,n(callviking),Dial(SIP/100,10,D(${ARG2}))
exten => s,n,Hangup()
[soundeffects]
exten => wakeupbell,1(wakeupbell),Answer()
same => n,Playback(custom/bells/daytimebell)
same => n,Hangup()
The macro is called like this:
[from-internal-custom] ;freepbx custom context
exten => 23333,1,Macro(Paginator,angelusbell,1) ;Angelus Bell
Here is an example of a method that works, except that I want to convert it into a macro so from so I can use the same routine with different dtmf tones (arg2) and soundfiles (arg1)
[AngelusBell]
exten => startbell,1,Answer()
exten => startbell,n, NoOp(Ringing-zee dee bell! ${CHANNEL} dialed: ${MACRO_EXTEN})
exten => startbell,n,System(asterisk -rx "channel originate Local/callviking#AngelusBell/n extension ting#soundeffects")
exten => startbell,n,Hangup()
exten => callviking,1,Dial(SIP/100,10,D(5))
exten => callviking,2,Hangup()
Well, this will work although it isn't very elegant. It's not a macro, but at least its all in one place:
[from-internal-custom] ;freepbx custom context
exten => 21005,1,Goto(Paginator,test,1) ;Test Sound via destination 2005 (is a custom-device-extension so as to be included as a Destination)
[Paginator]
exten => officebell,1,Answer()
exten => officebell,n,System(asterisk -rx "channel originate Local/callviking#${CONTEXT}/n extension ting#soundeffects")
exten => officebell,n,Hangup()
exten => startofficebell,1,Answer()
exten => startofficebell,n,System(asterisk -rx "channel originate Local/callviking1#${CONTEXT}/n extension ting#soundeffects")
exten => startofficebell,n,Hangup()
exten => angelusbell,1,Answer()
exten => angelusbell,n,System(asterisk -rx "channel originate Local/callviking1#${CONTEXT}/n extension ting#soundeffects")
exten => angelusbell,n,Hangup()
exten => test,1,Answer()
exten => test,n,System(asterisk -rx "channel originate Local/callviking1#${CONTEXT}/n extension ting#soundeffects")
exten => test,n,Hangup()
exten => callviking1,1,Dial(SIP/100,10,D(1))
exten => callviking1,n,Hangup()
exten => callviking5,1,Dial(SIP/100,10,D(5))
exten => callviking5,n,Hangup()
;------------------------------------------------------
[soundeffects]
exten => wakeupbell,1(wakeupbell),Answer()
same => n,Playback(custom/bells/daytimebell)
same => n,Hangup()

Asterisk - To reduce extension repitition in extensions.conf in a context

I have a very basic extensions.conf with the following context:
[LocalPhones]
exten => 1001,1,noop(Dialing ${PEX_ONE})
same => n,Macro(DialStartMonitor,${PEX_ONE})
same => n,Dial(SIP/${PEX_ONE},30,mTt)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
exten => 1002,1,noop(Dialing ${PEX_TWO})
same => n,Macro(DialStartMonitor,${PEX_TWO})
same => n,Dial(SIP/${PEX_TWO},30,mTt)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
exten => 1003,1,noop(Dialing ${PEX_THREE})
same => n,Macro(DialStartMonitor,${PEX_THREE})
same => n,Dial(SIP/${PEX_THREE},30,mTt)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
exten => 1004,1,Dial(Dialing ${PEX_FOUR})
same => n,Macro(DialStartMonitor,${PEX_FOUR})
same => n,Dial(SIP/${PEX_FOUR},10,m)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
exten => 1005,1,Dial(Dialing ${PEX_FIVE})
same => n,Macro(DialStartMonitor,${PEX_FIVE})
same => n,Dial(SIP/${PEX_FIVE},10,m)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
Is there a way I can combine all these into a single block (instead of 5 blocks like it is now) so that the extensions can dial each other (the extensions are from 1001 to 1010)?
Correct value-placement dialplan for asterisk is like this
exten => 1000,1,Set(trunk=${PEX_ONE})
exten => 1002,1,Set(trunk=${PEX_TWO})
exten => 1003,1,Set(trunk=${PEX_THREE})
exten => 1004,1,Set(trunk=${PEX_PHONE})
exten => 1005,1,Set(trunk=${PEX_FIVE})
; this will be executed after any of above
; note,it start from 2 prio(1 is from set above)
exten => _100[1-5],2,Noop(Dialing ${trunk})
same => n,Macro(DialStartMonitor,${trunk})
same => n,Dial(SIP/${trunk},10,m)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()
Note, your dialplan is still bad, becuase it play vm-nobodyavail even if user busy or communication was ok, but hanguped called user.
For correct dialplan like that you need analyze DIALSTATUS variable, check extensions.conf.sample for dialplan like that or read dialplan of freepbx.org software.
I think it will be something like bellow:
exten => _100[12345],1,Set(DIALTO=${PEX_ONE})
same => n,GotoIf($["${EXTEN:-1}" = "1"]?process)
same => n,Set(DIALTO=${PEX_TWO})
same => n,GotoIf($["${EXTEN:-1}" = "2"]?process)
same => n,Set(DIALTO=${PEX_THREE})
same => n,GotoIf($["${EXTEN:-1}" = "3"]?process)
same => n,Set(DIALTO=${PEX_FOUR})
same => n,GotoIf($["${EXTEN:-1}" = "4"]?process)
same => n,Set(DIALTO=${PEX_FIVE})
same => n(process),Macro(DialStartMonitor,${DIALTO})
same => n,Dial(SIP/${DIALTO},30,mTt)
same => n,Playback(vm-nobodyavail) ; Play "no one's available"
same => n,Hangup()