Asterisk - To reduce extension repitition in extensions.conf in a context - sip
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()
Related
ejabberd and JWT
I've been pounding at this for over a month following these: https://www.process-one.net/blog/ejabberd-19-08/ https://docs.ejabberd.im/admin/configuration/authentication/#jwt-authentication I've also been looking at posts like this one: JWT secret to use with ejabberd? I've tried decoding the "k" value in the generated jwk to sign the Token. Nothing is currently working. I'm not exactly sure what the log is telling me, for all I know its missing the module responsible for JWT authentication. my distribution is Garuda:Arch ejabberd: 21.07-1 I get a crashlog: 2021-10-28 08:45:10.146309-05:00 [error] <0.674.0> ** Generic server <0.674.0> terminating ** Last message in was {'$gen_event', {xmlstreamelement, {xmlel,<<"auth">>, [{<<"xmlns">>, <<"urn:ietf:params:xml:ns:xmpp-sasl">>}, {<<"mechanism">>,<<"PLAIN">>}], [{xmlcdata, <<"AGVyaWMAZXlKaGJHY2lPaUpJVXpJMU5pSXNJblI1Y0NJNklrcFhWQ0o5LmV5SnFhV1FpT2lKbGNtbGpRR3h2ZDJWa2IzZHVMblJySWl3aVpYaHdJam94TmpNMU5ETXdPVEF4ZlEuSUY0LTI4ME9hU1h5Tjl6Yl9jZkZiQk9jWjNEZTMzOV9Xa2JPUkRlbm0tQQ==">>}]}}} ** When Server state == #{mgmt_queue_type => ram,stream_header_sent => true, mgmt_state => inactive,tls_verify => false, stream_compressed => false, stream_timeout => {30000,-576458460293}, mgmt_stanzas_req => 0, codec_options => [ignore_els], socket_monitor => #Ref<0.687724880.2890924033.7168>, user => <<>>, pres_a => {0,nil}, tls_options => [compression_none], stream_state => wait_for_sasl_request, xmlns => <<"jabber:client">>,shaper => c2s_shaper, tls_required => false,stream_direction => in, mgmt_max_queue => 5000,csi_state => active, socket => {socket_state,ejabberd_http_ws, {http_ws,<0.673.0>, {{0,0,0,0,0,65535,32512,1},52662}}, 262144,undefined,none,none}, server => <<"**SECURED.COM**">>, csi_queue => {0,#{}}, lang => <<"en">>,access => c2s,mod => ejabberd_c2s, tls_enabled => false,lserver => <<"**SECURED.COM**">>, owner => <0.674.0>,mgmt_stanzas_in => 0, stream_authenticated => false, mgmt_max_timeout => 10800000, stream_restarted => false,mgmt_ack_timeout => 60000, zlib => false,resource => <<>>, mgmt_resend => if_offline, ip => {{0,0,0,0,0,65535,32512,1},52662}, stream_id => <<"9071053646738984762">>, mgmt_timeout => 10800000,stream_encrypted => false, stream_version => {1,0}, mgmt_stanzas_out => 0} ** Reason for termination == ** {'function not exported', [{crypto,hmac, [sha256, <<229,202,17,249,237,157,59,64,236,115,50,234,213,255,52,31,109, 41,169,46,98,176,188,245,108,155,161,54,88,230,126,175,76,111, 17,186,156,41,53,27,223,122,164,116,89,189,150,4,207,251,152,85, 18,80,49,19,137,243,49,205,5,134,110,182>>, <<"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqaWQiOiJlcmljQGxvd2Vkb3duLnRrIiwiZXhwIjoxNjM1NDMwOTAxfQ">>], []}, {jose_jwk_kty_oct,verify,4, [{file,"src/jose_jwk_kty_oct.erl"},{line,159}]}, {jose_jws,verify,2,[{file,"src/jose_jws.erl"},{line,379}]}, {jose_jwt,verify,2,[{file,"src/jose_jwt.erl"},{line,189}]}, {ejabberd_auth_jwt,check_jwt_token,3, [{file,"src/ejabberd_auth_jwt.erl"},{line,117}]}, {ejabberd_auth_jwt,check_password,4, [{file,"src/ejabberd_auth_jwt.erl"},{line,76}]}, {ejabberd_auth,db_check_password,7, [{file,"src/ejabberd_auth.erl"},{line,691}]}, {ejabberd_auth,'-check_password_with_authmodule/6-fun-0-',8, [{file,"src/ejabberd_auth.erl"},{line,248}]}]} My tokens are manually generated on jwt.io and key file is generated using mkjwk.org. I'm fully aware that I am probably missing something stupid, but like I previously stated, I've been pounding at this for quite some time, its time to ask for help.
Sending with method POST comes in as method GET with ZF3 Http Client
I'm trying to make a POST request with ZF3 Http Client but it comes in as a GET request all the time. I checked the manuals on the zend framework website but I can't find what I'm doing wrong. Probably it will be something small. My simple script from the client side is: $request = new Client(); $request->setUri('http://keuringapp.localhost/inspections/pdf/66'); $request->setMethod(Request::METHOD_POST); $response = $request->send(); die($response->getBody()); on the server side I have this: $test = $this->getRequest(); print_r($test);exit(); `` and it give met this result: Zend\Http\PhpEnvironment\Request Object ( [baseUrl:protected] => [basePath:protected] => [requestUri:protected] => /nl/inspections/pdf/66 [serverParams:protected] => Zend\Stdlib\Parameters Object ( [storage:ArrayObject:private] => Array ( [REDIRECT_APP_ENV] => development [REDIRECT_STATUS] => 200 [APP_ENV] => development [HTTP_HOST] => keuringapp.localhost [HTTP_CONNECTION] => close [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_USER_AGENT] => Zend\Http\Client [PATH] => /usr/bin:/bin:/usr/sbin:/sbin [SERVER_SIGNATURE] => [SERVER_SOFTWARE] => Apache [SERVER_NAME] => keuringapp.localhost [SERVER_ADDR] => ::1 [SERVER_PORT] => 80 [REMOTE_ADDR] => ::1 [DOCUMENT_ROOT] => /Applications/MAMP/htdocs/keuringapp/public [SERVER_ADMIN] => you#example.com [SCRIPT_FILENAME] => /Applications/MAMP/htdocs/keuringapp/public/index.php [REMOTE_PORT] => 55447 [REDIRECT_URL] => /nl/inspections/pdf/66 [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => GET [QUERY_STRING] => [REQUEST_URI] => /nl/inspections/pdf/66 [SCRIPT_NAME] => /index.php [PHP_SELF] => /index.php [REQUEST_TIME_FLOAT] => 1562241261.33 [REQUEST_TIME] => 1562241261 [argv] => Array ( ) [argc] => 0 ) )
This question can be closed. It was a problem due to a language setting in the url
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()
making Order in Paypal Parallel Express Checkout
I am trying to place Order with Parallel Paypal Express Checkout. Here is the API implementation. I am using PAYMENTREQUEST_0_PAYMENTACTION => Order in SetExpressCheckout and in DoExpressChecoutPayment and it gives error (this is required). When I use PAYMENTREQUEST_0_PAYMENTACTION => Order in SetExpressCheckout and PAYMENTREQUEST_0_PAYMENTACTION => Sale in DoExpressChecoutPayment it works. All goes well until DoExpressChecoutPayment. Please check this DoExpressCheckoutPayment Request ( [TOKEN] => EC-4U931568VK402050F [PAYERID] => BFSU67Z2LX5FJ [VERSION] => 97.0 [METHOD] => DoExpressCheckoutPayment [USER] => 'user' [PWD] => 'pwd' [SIGNATURE] => 'sig' [PAYMENTREQUEST_0_PAYMENTACTION] => ORDER [PAYMENTREQUEST_0_AMT] => 200.00 [PAYMENTREQUEST_0_CURRENCYCODE] => EUR [PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID] => vendortwo2#yhaoo.com [PAYMENTREQUEST_0_PAYMENTREQUESTID] => 25935 [PAYMENTREQUEST_1_PAYMENTACTION] => ORDER [PAYMENTREQUEST_1_AMT] => 22.00 [PAYMENTREQUEST_1_CURRENCYCODE] => EUR [PAYMENTREQUEST_1_SELLERPAYPALACCOUNTID] => vendorone#yahoo.com [PAYMENTREQUEST_1_PAYMENTREQUESTID] => 25934 ) and response from this is: ( [TOKEN] => EC-4U931568VK402050F [SUCCESSPAGEREDIRECTREQUESTED] => false [TIMESTAMP] => 2013-09-26T10:08:27Z [CORRELATIONID] => 2381c85a926e3 [ACK] => Failure [VERSION] => 97.0 [BUILD] => 7882219 [INSURANCEOPTIONSELECTED] => false [SHIPPINGOPTIONISDEFAULT] => false [PAYMENTINFO_0_PAYMENTSTATUS] => Failed [PAYMENTINFO_0_SELLERPAYPALACCOUNTID] => vendortwo2#yhaoo.com [PAYMENTINFO_0_SECUREMERCHANTACCOUNTID] => DRM9QQUAG9UNC [PAYMENTINFO_0_PAYMENTREQUESTID] => 25935 [PAYMENTINFO_0_ERRORCODE] => 10001 [PAYMENTINFO_0_SHORTMESSAGE] => Internal Error [PAYMENTINFO_0_LONGMESSAGE] => Internal Error [PAYMENTINFO_0_SEVERITYCODE] => Error [PAYMENTINFO_0_ACK] => Failure [PAYMENTINFO_1_PAYMENTSTATUS] => Failed [PAYMENTINFO_1_SELLERPAYPALACCOUNTID] => vendorone#yahoo.com [PAYMENTINFO_1_SECUREMERCHANTACCOUNTID] => M7HT95CA3PUCE [PAYMENTINFO_1_PAYMENTREQUESTID] => 25934 [PAYMENTINFO_1_ERRORCODE] => 10001 [PAYMENTINFO_1_SHORTMESSAGE] => Internal Error [PAYMENTINFO_1_LONGMESSAGE] => Internal Error [PAYMENTINFO_1_SEVERITYCODE] => Error [PAYMENTINFO_1_ACK] => Failure ) I have asked same question here.
Internal error came because wrong type of account ids are assigned to PAYMENTINFO_0_SELLERPAYPALACCOUNTID and PAYMENTINFO_1_SELLERPAYPALACCOUNTID in DoExpressCheckoutPayment request. Accounts assigned are personal, they should be paypal Business Accounts instead. that was the reason of "Internal Error". Thanks
Paypal Adaptive payment implementation on live environment
We have implemented Adaptive payment method. This implementation is working fine on sandbox environment. But its showing the following response in Live environment. We are not clear with the response. Can please provide the details about this response. Response: { Array (["en" class [send_method] => domestic;icon-uri [content_ID] => marketing_us/request_money;icon-uri [amp;from] => PayPal">Sign Up 2" width [label] => xuVFCJezswQQmbe91QM [guid] => ON [script] => 0"/> escalateTab">Contact [ ($("#mobile_number").val() !] => '')) { validPhoneNumber [page] => main%3Amktg%3Apersonal%3A%3Ahome%3A%3A%3A [tmpl] => core2HomeCExp.jsp [pgst] => Unknown [lgin] => out [calc] => f91c2b0c39598 [rsta] => en_US [md5h] => 7fbf0dfca87f30b51dc1d9cb8dae4318 [shfp] => %7C%7C [usce] => + [pgtf] => Sparta [s] => ci [aver] => unverified [rstr] => unrestricted [pfid] => f91c2b0c39598 [bzsr] => main [bchn] => mktg [pgsf] => personal [ccpg] => usa [pgld] => Unknown [shir] => main_mktg_personal_" alt [pgrp] => main%3Amktg%3Apersonal%3A%3Ahome ) }