How to get contact URI of specific peer in asterisk? - asterisk

I want to get contact URI of specific peer in asterisk from diaplan.I have two peers 2001 and 2001 I want contact URI of both peers how can I get this?

You can get any sip header(including contact ofcz) by using SIP_HEADER function.
h2*CLI> core show function SIP_HEADER
-= Info about function 'SIP_HEADER' =-
[Synopsis]
Gets the specified SIP header from an incoming INVITE message.
[Description]
Since there are several headers (such as Via) which can occur multiple times,
SIP_HEADER takes an optional second argument to specify which header with
that name to retrieve. Headers start at offset '1'.
[Syntax]
SIP_HEADER(name[,number])
[Arguments]
number
If not specified, defaults to '1'.
[See Also]
Not available
However it will give contact of INVITE field,not registration info. You can get SIPPEER function to get peer info.
h2*CLI> core show function SIPPEER
-= Info about function 'SIPPEER' =-
[Synopsis]
Gets SIP peer information.
[Description]
Not available
[Syntax]
SIPPEER(peername[,item])
[Arguments]
item
ip - (default) The ip address.
port - The port number.
mailbox - The configured mailbox.
context - The configured context.
expire - The epoch time of the next expire.
dynamic - Is it dynamic? (yes/no).
callerid_name - The configured Caller ID name.
callerid_num - The configured Caller ID number.
callgroup - The configured Callgroup.
pickupgroup - The configured Pickupgroup.
codecs - The configured codecs.
status - Status (if qualify=yes).
regexten - Registration extension.
limit - Call limit (call-limit).
busylevel - Configured call level for signalling busy.
curcalls - Current amount of calls. Only available if call-limit
is set.
language - Default language for peer.
accountcode - Account code for this peer.
useragent - Current user agent id for peer.
maxforwards - The value used for SIP loop prevention in outbound
requests
chanvar[name] - A channel variable configured with setvar for this
peer.
codec[x] - Preferred codec index number <x> (beginning with
zero).
[See Also]
Not available

Related

LE Connection CTE Request Enable unclear when CTE_Request_Interval is set to non-zero

This question rises from the Madrid r13 spec regarding the "LE Connection CTE Request Enable" command.
Some background about CTE_Request_Interval:
When CTE_Request_Interval is configured, a Controller which has an active "LE Connection CTE Request Enable" will transmit a LL_CTE_REQ every X Connection Intervals (which will be answered by a LL_CTE_RSP containing a CTE).
What I am trying to understand is: When is a "LE Connection CTE Request Enable" command still active.
From the spec:
"A request is active on a connection from when the Host issues a successful
command with Enable set to 0x01 until the single procedure has been
performed, the period specified by CTE_Request_Interval has ended, or a
command with Enable set to 0x00 has succeeded, whichever happens first".
From what I understand, a command ends when either:
CTE_Request_Interval is not set, which means that LL_CTE_REQ will be transmitted and answered only once by a LL_CTE_RSP and the request will not be active any longer
The host has disabled CTE (doesn't matter if CTE_Request_Interval was active as all other params are ignored when enable is set to 0)
Now the third case is what I'm having trouble with. The spec says:
"the period specified by CTE_Request_Interval has ended"
What does this mean?
From what I figure, CTE_Request_Interval happens periodically, so why would the request stop being active?
Maybe the spec means that the request is no longer active until the next period? Does this make any difference from an implementation perspective, or is it just semantics?
Thanks,
Maxim

How to route call from VoiceBlue Next device to Asterisk Server

I want to setup and IVR Menu i mean if a user calls to a particular GSM Number then the number should be redirected to Asterisk Server and the user needs to Get IVR Menu
I am using VoiceBlue Next firmware version 1.31.1.34.1 inserted working SIM Card
If i make a call to that particular number i am able to accept call,reject call and other options from VoiceBlueNext Web Interface.
I have made a SIP account in pjsip.conf file and created and extension as 100 in extensions.conf but unable to transfer the call to Asterisk Server
In asterisk server are there any other files to be changed or any settings in VoiceBlue Next
There are not many details to understand your scenario, I have not used VoiceBlue but on Asterisk if you want to receive calls, from your VoiceBlue or any other provider. You have to do two things, one you have to register this peer to allow receive calls, or you can also set allowguest=yes(but very dangerous anyone can send you calls) or add peers at end of pjsip.conf file as little secure way.
Next, you need to add dialplan, suppose if you get any number _X will be any number, now you can put Dial your extension to receive any number from the provider.
As for sip client to call out you have to register peer and both must be in the same context.
Sending outgoing calls, now if you call any number beginning 6 and 7 they will be forwarded to VoiceBlue
exten=>_6XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
exten=>_7XXXXXXXX,1,Dial(SIP/${EXTEN:0}#10.0.0.20,,r)
for incoming please add following in your pjsip.conf
[VoiceBlueNext]
type=peer
host=10.0.0.20
username=voiceblue
secret=password
fromdomain=10.0.0.20
and in same file on top put following general section
[general]
port = 5060
bindaddr = 0.0.0.0
allowgues=no
context = sip
disallow=all
allow=ulaw
Notice I allowguest = no , so you must provide peer VoiceBlue peer information to receive calls, but if you want to test, make it yes and you will get calls without any security.

Does MQTT brokers support persistent subscriptions?

I work on my first IOT POC, the device will usually generate sensor data once per hour/day. I planned to have architecture like this:
- 1 shared topic for sensor data input (device to backend direction)
- Each device will subscribe initially to its own specific topic aka /device/{id}/notification
Now, after sensor data submitted to shared topic, I plan to put device into deep sleep (device can only be waked-up by wifi packet or timer), in this state TCP connection to broker is lost.
Question: After device is back waked-up and TCP connection to MQTT broker is re-established, will the device receive all messages which were generated by server during out-of-service period, or these messages won't be available?
During client connecting to the broker, the CleanSession flag enables the broker to queue up missed messages of QoS 1 or QoS 2 (storing QoS 0 messages is implementation-dependent).
The MQTT 3.1.1 Standard Section 3.1.2.4 specifies that:
If CleanSession is set to 0, the Server MUST resume communications with the Client based on state from the current Session (as identified by the Client identifier). If there is no Session associated with the Client identifier the Server MUST create a new Session. The Client and Server MUST store the Session after the Client and Server are disconnected [MQTT-3.1.2-4]. After the disconnection of a Session that had CleanSession set to 0, the Server MUST store further QoS 1 and QoS 2 messages that match any subscriptions that the client had at the time of disconnection as part of the Session state [MQTT-3.1.2-5]. It MAY also store QoS 0 messages that meet the same criteria
The problem with a persistent session is that it may queue up large numbers of messages, so upon re-connection the client is bombarded with missed messages. This may be desirable if you require to know the full sequence of readings, or highly undesirable if the client is running on a low-power, battery-fed embedded device.
To address this, MQTT provides another feature: retained flag in publication messages.
The MQTT 3.1.1 Standard Section 3.3.1.3 specifies that:
If the RETAIN flag is set to 1, in a PUBLISH Packet sent by a Client to a Server, the Server MUST store the Application Message and its QoS, so that it can be delivered to future subscribers whose subscriptions match its topic name [MQTT-3.3.1-5]. When a new subscription is established, the last retained message, if any, on each matching topic name MUST be sent to the subscriber [MQTT-3.3.1-6]. If the Server receives a QoS 0 message with the RETAIN flag set to 1 it MUST discard any message previously retained for that topic. It SHOULD store the new QoS 0 message as the new retained message for that topic, but MAY choose to discard it at any time - if this happens there will be no retained message for that topic
This ensures that upon re-connection the client receives only the latest message on a given topic.
Very quickly I found an answer by myself. Persistent Session is the anwer. I was looking for persistent subscription and wasn't initially successful...
Here is finally great article about my case:
http://www.hivemq.com/blog/mqtt-essentials-part-7-persistent-session-queuing-messages
So yes, persistent subscriptions is called persistent sessions and yes it is possible.

Call Transfer to Different Host/IP in Asterisk

Is it possible to transfer call to different host in asterisk?
Like I have three asterisk instances in line i.e A, B and C. The scenario is that the call will come from A to B and B will transfer the call to C and after successful transfer, B will not be facilitator and A will directly be communicating with C
Correct setup is have kamailio or opensips proxy infront of asterisk.
For asterisk ff you have on all instances in trunks settings
canreinvite=yes
directmedia=yes
and if you have SIP protocol, you can do Transfer call. If you do that before call setup will be full transfer,if after setup - only last option will work, so signaling will still go via this host, while media go directly.
Both options may not work if provider NOT support that.
pro-sip*CLI> core show application Transfer
-= Info about application 'Transfer' =-
[Synopsis]
Transfer caller to remote extension.
[Description]
Requests the remote caller be transferred to a given destination. If TECH
(SIP, IAX2, LOCAL etc) is used, only an incoming call with the same channel
technology will be transferred. Note that for SIP, if you transfer before
call is setup, a 302 redirect SIP message will be returned to the caller.
The result of the application will be reported in the ${TRANSFERSTATUS}
channel variable:
${TRANSFERSTATUS}:
SUCCESS: Transfer succeeded.
FAILURE: Transfer failed.
UNSUPPORTED: Transfer unsupported by channel driver.
[Syntax]
Transfer([Tech/]destination)
[Arguments]

Asterisk / Freepbx does not set CallerID to calling party when queue contains a cell phone

Does Asterisk / FreePBX support the ability to pass the caller ID of an inbound caller to a remote support agent (on a cell phone)?
Our work has a queue for incoming calls which contains "remote agents" (people on cell phones). To the cell phone agents, all calls appear to be coming from our main number (385-111-1111). We would like the calls to appear to be coming from the caller (201-555-5555).
This is not a problem with our SIP trunk provider. In the past we used different PBX software, with the same SIP trunk provider, and it was able to set the Caller ID properly. Extensions are capable of setting and passing arbitrary Caller ID, only calls from queues retain the main number.
Outgoing PEER Details:
host=sip.provider.com
type=friend
trustrpid=yes
sendrpid=yes
I've manipulated so many settings that I've come to wonder if Asterisk / FreePBX simply does not support this. Has anyone successfully been able to do this?
Asterisk certainly does. Capture the CID in a dialplan variable at the beginning of the call and set the outbound CID to the same value before passing it on.
There's no direct way to do this within the FreePBX GUI but there is a workaround:
Set up a virtual extension
Enable follow-me on the extension, add the mobile number to the follow-me list
Set the follow-me CID mode to default
Ensure the queue's agent restrictions allow the use of follow-me numbers
Have the agent log into the queue using the virtual extension instead of their mobile number
The default behaviour for the follow-me extension is to pass the incoming caller ID out. So, some flexibility is lost (mobile numbers have to be changed in follow-me settings) but it does allow the desired behaviour.
Asterisk supports setting the callerid for all outgoing or redirected calls. I did this with v1.8 and v13.7 as I'm facing the exact same requirements.
This feature depends on the provider and the contract they setup with you. My Provider calls it "Special Arrangement / Clip no screening". In my case they use "P-Asserted-Identity" to find callerid.
I had to set the following options in the outgoing sip trunk in sip.conf:
trustrpid=yes
sendrpid=pai

Resources