Re: [asterisk-users] Get SIP Call-ID from ARI

2023-06-17 Thread Joshua C. Colp
On Sat, Jun 17, 2023 at 8:41 PM TTT  wrote:

> I tried
>
> GET /channels/{channelid}/variable?variable=CHANNEL(pjsip,call-id)
>
>
>
> But it responds with
>
> "message": "Channel not in Stasis application"
>
>
>
> Since I want to get the call-id for a channel not in stasis I guess that
> won’t work.  Similarly, I can’t force the channel through my own code in
> the dialplan, so the PJSIP_HEADER function won’t work.  So it looks like
> I’ll have to upgrade my Asterisk test system to get the Call-ID from the
> ARI event.  It looks like it was added in Ast 16.
>
>
>
> Out of curiosity, I see that call-id is returned in the “protocol_id”
> field of channel data structure.  However, since all channels in the same
> call must have the same Call-ID, how can this data be associated with a
> channel?  Wouldn’t it have to be associated with a bridge?  The Call-ID
> should not be available until two legs are bridged (I think).
>

All channels in a call do not have the same Call-ID. Each channel has its
own SIP Call-ID (if it is a PJSIP channel) as they are individual call legs
and individual SIP dialogs.

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Get SIP Call-ID from ARI

2023-06-17 Thread TTT
I tried 

GET /channels/{channelid}/variable?variable=CHANNEL(pjsip,call-id)

 

But it responds with

"message": "Channel not in Stasis application"

 

Since I want to get the call-id for a channel not in stasis I guess that won’t 
work.  Similarly, I can’t force the channel through my own code in the 
dialplan, so the PJSIP_HEADER function won’t work.  So it looks like I’ll have 
to upgrade my Asterisk test system to get the Call-ID from the ARI event.  It 
looks like it was added in Ast 16.

 

Out of curiosity, I see that call-id is returned in the “protocol_id” field of 
channel data structure.  However, since all channels in the same call must have 
the same Call-ID, how can this data be associated with a channel?  Wouldn’t it 
have to be associated with a bridge?  The Call-ID should not be available until 
two legs are bridged (I think).

 

Brian

 

 

From: asterisk-users [mailto:asterisk-users-boun...@lists.digium.com] On Behalf 
Of Joshua C. Colp
Sent: Saturday, June 17, 2023 2:25 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion 

Subject: Re: [asterisk-users] Get SIP Call-ID from ARI

 

On Sat, Jun 17, 2023 at 2:55 PM TTT mailto:li...@telium.io> > 
wrote:

Based on postings it should be possible to get the SIP Call-ID header value 
from the ARI.  At what point is this value available ?  As well, how do I 
retrieve that value – something like

 

GET /channels/{channelId}/pjsip_header?key=Call-Id

 

But that doesn’t work.

 

'pjsip_header' is not a valid route. All possible routes are documented on the 
wiki, if it's not there then it doesn't exist.

 

Instead you would use variable[1] to execute the PJSIP_HEADER dialplan 
function[2] or a better way would be the CHANNEL dialplan function[3] such as:

 

GET /channels/{channelid}/variable?variable=CHANNEL(pjsip,call-id)

 

Though I haven't tested that.

 

Newer versions also include the protocol identifier (Call-ID) in the channel 
ARI structure[4] which would be in events, or explicitly retrieved[5].

 

[1] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Channels+REST+API#Asterisk20ChannelsRESTAPI-getChannelVar

[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Function_PJSIP_HEADER

[3] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Function_CHANNEL

[4] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+REST+Data+Models#Asterisk20RESTDataModels-Channel

[5] 
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Channels+REST+API#Asterisk20ChannelsRESTAPI-get

 

-- 

Joshua C. Colp

Asterisk Project Lead

Sangoma Technologies

Check us out at www.sangoma.com   and www.asterisk.org 
 

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Expanding my answering-machine system

2023-06-17 Thread Joshua C. Colp
On Sat, Jun 17, 2023 at 7:48 PM Steve Matzura  wrote:

> OK, this is how I thought it's supposed to work. It just confounded me why
> the book would say the Playback() and Background() syntax were the same,
> then in the very next paragraph give an example that belied that claim.
>

The syntax is the same. They both take a filename. The example gave a
filename of "enter-ext-of-person". You could pass that to Playback, though
you would be unable to enter an extension.

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Expanding my answering-machine system

2023-06-17 Thread Steve Matzura
OK, this is how I thought it's supposed to work. It just confounded me 
why the book would say the Playback() and Background() syntax were the 
same, then in the very next paragraph give an example that belied that 
claim.



On 6/17/2023 1:46 PM, Doug Lytle wrote:

On 6/17/23 08:47, Steve Matzura wrote:


Both Background()  and WaitExten()  allow the caller to enter DTMF 
digits. Asterisk then attempts to find an extension in the current 
context that matches the digits that the caller entered. If Asterisk 
finds a match, it will send the call to that extension.



My question then is, is "*" a valid exension, as in:



I'd have to assume yes.  I don't use WaitExten() and I set 
autofallthrough=no in the /etc/asterisk.conf, since that is the way 
I've always expected Asterisk to work; my dialplan examples are based 
on that.


The below example shows a call coming into a DID, playing background 
prompts and excepting input during play.



;
;* Auto attendant
;

exten => 5175551212,1,Gosub(check-blacklist,s,1)
 same => n,Gosub(check-hours,s,1)
 same => n,Gosub(holiday-check,s,1)
 same => n,Gosub(get-callerid,s,1)
 same => n,Goto(auto-attend,s,1)

[auto-attend]

include => dial-by-extension

;*
;* Set timeouts
;*

exten => s,1,Set(TIMEOUT(response)=8)
 same => n,Set(TIMEOUT(digit)=2)
 same => n,Set(LOOPCOUNT=0)

 same => n,GotoIf($["${Holiday}" = "YES"]?HOLIDAY:BEGIN)
 same => n(BEGIN),Answer()
 same => n,Wait(1)

;
;* Play the 'Welcome message' and office hours message
;

 same => n,Background(${voice}/welcome)
 same => n,Background(${voice}/business_hours)
 same => n,Background(${voice}/8am_5pm)
 same => n(HOLIDAY),Background(${voice}/dial_anytime)
 same => n(DIRECTORY),Background(${voice}/directory_assist)
 same => n,Background(${voice}/press_1)
 same => n,Background(${voice}/to_ring_after_hours)
 same => n,Background(${voice}/press_2)
 same => n,Background(${voice}/absence_delay)
 same => n,Background(${voice}/press_3)

;
;* If 1 is pressed, go to Dial by name
;

exten => 1,1,Goto(directory,s,1)

;***
;* If 2 is pressed, dial the Foyer phone
;***

exten => 2,1,Goto(dial-by-extension,4255,1)

;***
;* If 3 is pressed, dial absence/delay extension
;***

exten => 3,1,Gosub(cellphone-callerid,s,1)
exten => 3,n,Voicemail(3888@sip,us)
exten => 3,n,Hangup()

;
;* If 8# is pressed, go to Voicemail Main menu
;

exten => 8#,1,VoiceMailMain(@sip)
exten => 8#,2,Hangup()

This is not the complete dialplan; I also have error checking and a 
loop counter.


Doug

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Get SIP Call-ID from ARI

2023-06-17 Thread Joshua C. Colp
On Sat, Jun 17, 2023 at 2:55 PM TTT  wrote:

> Based on postings it should be possible to get the SIP Call-ID header
> value from the ARI.  At what point is this value available ?  As well, how
> do I retrieve that value – something like
>
>
>
> GET /channels/{channelId}/pjsip_header?key=Call-Id
>
>
>
> But that doesn’t work.
>

'pjsip_header' is not a valid route. All possible routes are documented on
the wiki, if it's not there then it doesn't exist.

Instead you would use variable[1] to execute the PJSIP_HEADER dialplan
function[2] or a better way would be the CHANNEL dialplan function[3] such
as:

GET /channels/{channelid}/variable?variable=CHANNEL(pjsip,call-id)

Though I haven't tested that.

Newer versions also include the protocol identifier (Call-ID) in the
channel ARI structure[4] which would be in events, or explicitly
retrieved[5].

[1]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Channels+REST+API#Asterisk20ChannelsRESTAPI-getChannelVar
[2]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Function_PJSIP_HEADER
[3] https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Function_CHANNEL
[4]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+REST+Data+Models#Asterisk20RESTDataModels-Channel
[5]
https://wiki.asterisk.org/wiki/display/AST/Asterisk+20+Channels+REST+API#Asterisk20ChannelsRESTAPI-get

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Get SIP Call-ID from ARI

2023-06-17 Thread TTT
Based on postings it should be possible to get the SIP Call-ID header value
from the ARI.  At what point is this value available ?  As well, how do I
retrieve that value - something like

 

GET /channels/{channelId}/pjsip_header?key=Call-Id

 

But that doesn't work.

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Expanding my answering-machine system

2023-06-17 Thread Doug Lytle

On 6/17/23 08:47, Steve Matzura wrote:


Both Background() and WaitExten()  allow the caller to enter DTMF 
digits. Asterisk then attempts to find an extension in the current 
context that matches the digits that the caller entered. If Asterisk 
finds a match, it will send the call to that extension.



My question then is, is "*" a valid exension, as in:



I'd have to assume yes.  I don't use WaitExten() and I set 
autofallthrough=no in the /etc/asterisk.conf, since that is the way I've 
always expected Asterisk to work; my dialplan examples are based on that.


The below example shows a call coming into a DID, playing background 
prompts and excepting input during play.



;
;* Auto attendant
;

exten => 5175551212,1,Gosub(check-blacklist,s,1)
 same => n,Gosub(check-hours,s,1)
 same => n,Gosub(holiday-check,s,1)
 same => n,Gosub(get-callerid,s,1)
 same => n,Goto(auto-attend,s,1)

[auto-attend]

include => dial-by-extension

;*
;* Set timeouts
;*

exten => s,1,Set(TIMEOUT(response)=8)
 same => n,Set(TIMEOUT(digit)=2)
 same => n,Set(LOOPCOUNT=0)

 same => n,GotoIf($["${Holiday}" = "YES"]?HOLIDAY:BEGIN)
 same => n(BEGIN),Answer()
 same => n,Wait(1)

;
;* Play the 'Welcome message' and office hours message
;

 same => n,Background(${voice}/welcome)
 same => n,Background(${voice}/business_hours)
 same => n,Background(${voice}/8am_5pm)
 same => n(HOLIDAY),Background(${voice}/dial_anytime)
 same => n(DIRECTORY),Background(${voice}/directory_assist)
 same => n,Background(${voice}/press_1)
 same => n,Background(${voice}/to_ring_after_hours)
 same => n,Background(${voice}/press_2)
 same => n,Background(${voice}/absence_delay)
 same => n,Background(${voice}/press_3)

;
;* If 1 is pressed, go to Dial by name
;

exten => 1,1,Goto(directory,s,1)

;***
;* If 2 is pressed, dial the Foyer phone
;***

exten => 2,1,Goto(dial-by-extension,4255,1)

;***
;* If 3 is pressed, dial absence/delay extension
;***

exten => 3,1,Gosub(cellphone-callerid,s,1)
exten => 3,n,Voicemail(3888@sip,us)
exten => 3,n,Hangup()

;
;* If 8# is pressed, go to Voicemail Main menu
;

exten => 8#,1,VoiceMailMain(@sip)
exten => 8#,2,Hangup()

This is not the complete dialplan; I also have error checking and a loop 
counter.


Doug
-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Expanding my answering-machine system

2023-06-17 Thread Steve Matzura

Doug,


This is where the weeds start growing.


On 6/17/2023 4:55 AM, Doug Lytle wrote:


For both capabilities, you can use Background() instead of Playback() 
for audio prompts.  Background() allows for interrupting the prompts 
and continue on with your dialplan.


Understood. From the book:



The most common use of the Background() application is to create basic 
voice menus (often called auto attendants, IVRs ,  9 or phone trees ).



But now, the confusion:


Background() has the same syntax as Playback()  :

  [TestMenu]
exten => start,1,Answer()
  same => n,Background(enter-ext-of-person)


Stop right there. The syntax of Playback() is Playback(filename), 
there's no extension number.



More book:

Both Background() and WaitExten()  allow the caller to enter DTMF 
digits. Asterisk then attempts to find an extension in the current 
context that matches the digits that the caller entered. If Asterisk 
finds a match, it will send the call to that extension.



My question then is, is "*" a valid exension, as in:


exten => *,VoicemailMain()


-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Expanding my answering-machine system

2023-06-17 Thread Doug Lytle

On 6/16/23 20:29, Steve Matzura wrote:
As always, thanks in advance for a kick in the right direction. 


For both capabilities, you can use Background() instead of Playback() 
for audio prompts.  Background() allows for interrupting the prompts and 
continue on with your dialplan.


Doug-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
  https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users