Dial -Out with Asterisk Sip - circuit is busy error - voip

Okey İ handled my problem,
Problem is provider. it is rejected my request! All problem provider that means trunk!
I have a asterisk server 1.6 and a trunk. i tried to call my cell phone on trunk(provider)
when i call my cell phone it gives me :
-- Executing [0506610XXXX#phone:1] NoOp("SIP/1001-0000009b", "") in new stack
-- Executing [0506610XXXX#phone:2] Dial("SIP/1001-0000009b", "SIP/312XXXXXXX
/0506610XXXX") in new stack
== Using SIP RTP CoS mark 5
-- Called 312XXXXXXX/0506610XXXX
-- SIP/3XXXXXXXX-0000009c is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
-- Executing [0506610XXXX#phone:3] Hangup("SIP/1001-0000009b", "") in new stack
== Spawn extension (phone, 0506610XXXX, 3) exited non-zero on 'SIP/1001-0000009b'
i tried varios things;
#sip show peers- all ok all registered
#sip show registry - my trunk is ok registered
my sip.conf
[general]
register=>XXXXXX:XXXXXX#ipaddress/312911
[312911]
type=friend
secret=XXXXX
username=312911
host=ipaddress
insecure=invite ,port
context=aaa
[1001]
type=friend
dtmfmode=rfc2833
context=phone
host=dynamic
secret=XX
callerID="1001"<1001>
nat=yes
my extension.conf
[myphones]
exten=> _XXX.,1,NoOp()
exten=> _XXX.,n,Dial(SIP/312911/${EXTEN})
exten=> _XXX.,n,Hangup()
[incoming]
exten=>_X.,1,NoOp()
exten=>_X.,n,Dial(SIP/1001)
exten=> _X.,n,Hangup()
[internal]
exten=>_1XXX,1,Dial(SIP/${EXTEN})
exten=>_1XXX,n,Hangup()
[phone]
include=>internal
include=>myphones
[aaa]
include=>incoming
include=>myphones

Some common causes which will generate this kind of error:
1) Provider needs registration where you are not giving register and only created peer.
2) The format is wrong. Some provider needs 00 as ISD, some do not. So check that you are using the correct number format.
3) The outbound circuit is full. It happens where there is no channel left from the provider side or you are not allowed to create more channels.
4) Some providers don't support multiple registry.
Fore more details you need to enable "sip set debug ip < provider ip address> and then make the call and check each packet.

on asterisk console:
set verbose 0 // optional
set debug 0 // optional
set sip debug
it seems that your trunk is not working(wrong number format, invalid login/pass,...)
in sip messages U'll see real error

Related

Blind Call Transfer in Asterisk | ari-client (Node.js)

Precise overview about the flow:
I am calling my initial extension(100) using Zoiper through Twilio sip domain using Zoiper as soft phone which actually direct the call to my asterisk server.
Now when my call is in asterisk server I'm trying to forward it to another extension using Zoiper. I have already configured it according to documentation provided by asterisk will also be attaching the reference links.
I just want to forward the current call to a particular extension. So please can anyone guide me that how it can be possibly done?
ari-client
bridge.once(‘BridgeAttendedTransfer’, event => {
var transferee = new ari.Channel(event.transferee.id);
transferee.continueInDialplan({
context: event.context,
extension: event.exten,
priority: 1
});
});
extension.conf
exten => 201,1,Dial(SIP/201,20,tT)
features.conf
blindxfer = #2 ("#2" or "##" instead of "#1")
atxfer = *2
transferdigittimeout = 1; Number of seconds to wait between digits when transferring a call
xfersound = beep ; to indicate an attended transfer is complete
xferfailsound = beeperr ; to indicate a failed transfer
transferdialattempts = 3 ; Number of times that a transferer may attempt to dial an extension before
being kicked back to the original call.
transferretrysound = "beep" ; Sound to play when a transferer fails to dial a valid extension.
transferinvalidsound = "beeperr" ; Sound to play when a transferer fails to dial a valid extension
Using Zoiper to make a transfer
References:
https://wiki.asterisk.org/wiki/display/AST/Feature+Code+Call+Transfers
https://www.aska-ltd.jp/en/blog/185
https://community.asterisk.org/t/call-transfer-not-working-on-softphones/33817
https://asteriskfaqs.org/2020/12/22/uncategorized/handling-transfers-with-ari.html
Trying to implement blind call transfer.

How to get status of placed call on Amazon Connect?

I'm writing an app which sends an automated call via Amazon Connect. The app needs to retry to another destination number should the first one fail to pick up. The app is being written in Python3 and is to be hosted in Lambda.
This is the resource is used
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/connect.html#Connect.Client.get_contact_attributes
https://docs.aws.amazon.com/connect/latest/APIReference/API_GetContactAttributes.html
The problem is that "send call" is kicked off asynchronously and so it is not immediately clear if the call has succeeded or not. To check the call I invoke "get_contact_attributes" to identify status or any attributes which could point to the status of the placed call.
response=client.start_outbound_voice_contact(
ContactFlowId='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
DestinationPhoneNumber=event["DestinationPhoneNumber"],
SourcePhoneNumber=event["OriginationPhoneNumber"],
InstanceId="YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY",
Attributes={
"message":f'{event["message"]}'
}
)
contactid=response["ContactId"]
attr = client.get_contact_attributes(
InstanceId='YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY',
InitialContactId=contactid
)
I expected it to return "connected_at" or something like it I could use to identify the outcome of the call, however, it only returns "custom" attributes set by myself.
this is the solution i found:
1) in the Contact Flow i added "Set Attribute" node where i set "status=1" right after the start. Basically, if a call enters Contact Flow (i.e. call picked up) it is marked as successfully completed
Set Contact Sttributes
2) inside my Python code (lambda) i check for the status to show up and if it doesn't in so many seconds i cancel the call and try another number:
attr = client.get_contact_attributes(
InstanceId=instanceid,
InitialContactId=contactid
)
stop_call=client.stop_contact(
ContactId=contactid,
InstanceId=instanceid
)

how to make outgoing call from freeswitch and play file after destination answer call?

I want to write a web app that connects to freeswitch and makes outgoing call to some destination number (gateway for landline or internal sip devices) and plays some sounds (may be do some logic in lua script).
After reading freeswitch wiki, I found originate command but it doesn't work for me (I just test for internal sip number - sofia/internal/username#ip ). If originate command can do this, how to use it properly? If there is another way please tell me.
Originate command is used to make the call and bridge command is used to bridge the call. You can call originate command externally by using esl socket.
Examples:
originate {ignore_early_media=true,originate_timeout=60}sofia/gateway/name/number &playback(message)
Refer to this for esl written in node.js
https://github.com/englercj/node-esl
one way that I test and it work is run a lua script from freeswitch console or ESL:(ex "luarun test.lua")
https://freeswitch.org/confluence/display/FREESWITCH/Lua+API+Reference#LuaAPIReference-session:hangupCause
obSession = freeswitch.Session("sofia/192.168.0.4/1002")
-- Check to see if the call was answered
if obSession:ready() then
-- Play file here
else
-- This means the call was not answered ... Check for the reason
local obCause = obSession:hangupCause()
freeswitch.consoleLog("info", "obSession:hangupCause() = " .. obCause )
if ( obCause == "USER_BUSY" ) then -- SIP 486
-- For BUSY you may reschedule the call for later
elseif ( obCause == "NO_ANSWER" ) then
-- Call them back in an hour
elseif ( obCause == "ORIGINATOR_CANCEL" ) then -- SIP 487
-- May need to check for network congestion or problems
else
-- Log these issues
end
end
You can do it very easily from dial plan:
<action function="play-file" data="myfile.wav"/>
You can make the wav play when someone start a call, follow these steps.
Place your wave into your freeswitch/conf folder.
Add the code bellow to your freeswitch/conf/autoload_configs
Run a HTTP server that receives a POST request and returns your dialplan(which tells freeswitch to play your wav).
Make sure your freeswitch/conf/autoload_configs/xml_curl.conf.xml looks like this
<param name="gateway-url" value="http://yourIP:yourServerPort/dialplan.xml" bindings="dialplan"/>
Hope this helps.
you can achieve By using a socket[ESL] application.
https://wiki.freeswitch.org/wiki/Event_Socket_Outbound

How to update my Asterisk Dial-Plan for combination of Telephone Number?

I am trying to create dialplan for incoming/outgoing for given numbers:
+xx xxx [xxxxxxxxx|xxxxxxxx]
I have already configure my service provider information in sip.conf
[sipprovider]
type=friend
secret=xxxxx
defaultusername=xxxxx
host=xxx.xx.xx.xxx
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw
allow=alaw
allow=gsm
insecure=port,invite
;fromdomain=xxx.xx.xx.xxx
context=default
nat=yes
Now, I want to create incoming/outgoing trunk, my extensions allow to dial international calls and incoming call received on given number.
+xx xxx [xxxxxxxxx|xxxxxxxx]
[default]
switch => Realtime
exten => 55,1,Verbose(1,Echo test application)
exten => 55,n,Dial(SIP/sipprovider/0091XXXXX99999#sipprovider); Here is the outbound call, the exact dialstring depends on outgoing provider and channeltype
exten => 55,n,Hangup()
Display: Calling....
and then, VM Play: Person you are calling is unavailable
Asterisk Console:
== Using SIP RTP CoS mark 5
-- Executing [55#default:1] Verbose("SIP/3001-00000029", "1,Echo test application") in new stack
Echo test application
-- Executing [55#default:2] Dial("SIP/3001-00000029", "SIP/sipprovider/0091XXXXX99999#sipprovider") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/sipprovider/0091XXXXX99999#sipprovider
[Aug 17 18:29:02] WARNING[32467]: chan_sip.c:4024 retrans_pkt: Retransmission timeout reached on transmission 78a9b28011fd522601047c9317adca91#xx.xx.xx.xx:5060 for seqno 102 (Critical Request) -- See https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions
Packet timed out after 32000ms with no response
[Aug 17 18:29:02] WARNING[32467]: chan_sip.c:4053 retrans_pkt: Hanging up call 78a9b28011fd522601047c9317adca91#xx.xx.xx.xx:5060 - no reply to our critical packet (see https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions).
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [55#default:3] Hangup("SIP/3001-00000029", "") in new stack
== Spawn extension (default, 55, 3) exited non-zero on 'SIP/3001-00000029'
-- Executing [h#default:1] Verbose("SIP/3001-00000029", "Hangup...") in new stack
Hangup...
Basically a dialstring can be in 'SIP/devicename/extension' or 'SIP/username#host' format. SIP/sipprovider/0091XXXXX99999#sipprovider is wrong.
"Retransmission timeout reached" means that asterisk tries to send an INVITE to sipprovider, but sipprovider's SIP port (5060 UDP) isn't accessible. You can see this in SIP debug.

App Inventor 2: Not finding a specific block

In the App Inventor 2, where is the block mentioned in last item (figure) of the url: http://beta.appinventor.mit.edu/learn/reference/blocks/definition.html
I am trying to use bluetooth to connect my custom device with Android App.
The internet says:
This block provides a "dummy socket" for fitting a block that has a
plug on its left into a place where there is no socket, such as one of
the sequence of blocks in the do part of a procedure or an if block.
The block you fit in will be run, but its returned result will be
ignored. This can be useful if you define a procedure that returns a
result, but want to call it in a context that does not accept a
result.
You are looking for the evaluate but ignore result block
However in your bluetooth connecting example let me recommend you to use an if statement instead
if BluetoothClient1.connect ...
then do something
else display a message, e.g. "connection was not successful"
see also this bluetooth example
and see the documentation of the Bluetooth components
boolean Connect(text address)
Connect to the Bluetooth device with the specified address and the Serial Port Profile (SPP).
Returns true if the connection was successful.

Resources