[Home]

Summary:ASTERISK-11874: SetCallerPres() does not consume the same format as ${CALLINGPRES} channel variable returns
Reporter:Philippe Lindheimer (p_lindheimer)Labels:
Date Opened:2008-04-17 22:14:53Date Closed:2008-04-18 01:49:27
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_setcallerid
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) patch-presentation
Description:Please note - I discussed this issue with Jared Smith in the IRC and he requested that I post it. It is one of those grey areas - kind of a bug but kind of a feature request...

SetCallerPres() expects to receive values like 'allowed_not_screened', which is fine. However, when you pull the current channels value from ${CALLINGPRES} it is returned as the numeric value from the PRI. One would expect to be able to feed this same numeric value returned form the channel variable back into the SetCallerPres() application in addition to the friendly versions.

So for example, the following 'should' work:

exten => 9157,n,SetCallerPres(prohib)
exten => 9157,n,Noop(${CALLINGPRES})                                                                                                                                          
exten => 9157,n,SetCallerPres(${CALLINGPRES})

But of course the result is:

[Mar 12 07:40:30] VERBOSE[14438] logger.c:     -- Executing [9157@from-internal:22] SetCallerPres("SIP/923-08e5ea88", "prohib") in new stack
[Mar 12 07:40:30] VERBOSE[14438] logger.c:     -- Executing [9157@from-internal:23] NoOp("SIP/923-08e5ea88", "35") in new stack
[Mar 12 07:40:30] VERBOSE[14438] logger.c:     -- Executing [9157@from-internal:24] SetCallerPres("SIP/923-08e5ea88", "35") in new stack
[Mar 12 07:40:30] WARNING[14438] app_setcallerid.c: '35' is not a valid presentation (see 'show application SetCallerPres')

I have not checked if this has been addressed in 1.6, but Jared said he took a look and didn't think so.

****** ADDITIONAL INFORMATION ******

The scenario where I encountered this is as follows. I have an inbound call and I want to prepend a value to the CallerID Name. If the call comes in as an anonymous call, even if I prepend it, when I send out the call to SIP phones the SIP channel honors the Calling Presence and sends out nothing (all anonymous). In order to get around this, I want to save the current value of ${CALLINGPRES} and then send the call on its way in the dialplan. If one of the phones has call forwarding or some sort of followme set, and the call ends up going back out the PRI, I want to put the ${CALLINGPRES} 'back the way I found it.' Unfortunately, I can't just reset it in a saved variable because of this issue. (And there is a good reason I want to send it back out the way I found it).

Here is a simple dialplan to test all the values returned:

exten => 9157,1,SetCallerPres(allowed_not_screened)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(allowed_passed_screen)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(allowed_failed_screen)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(allowed)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(prohib_not_screened)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(prohib_passed_screen)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(prohib_failed_screen)
exten => 9157,n,Noop(${CALLINGPRES})
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(prohib)
exten => 9157,n,Noop(${CALLINGPRES})                                                                                                                                          
exten => 9157,n,SetCallerPres(${CALLINGPRES})
exten => 9157,n,SetCallerPres(unavailable)                                                                                                                                    
exten => 9157,n,Noop(${CALLINGPRES})                                                                                                                                          
exten => 9157,n,SetCallerPres(${CALLINGPRES})                                                                                                                                  
exten => 9157,n,hangup                                                                                                                                                        
Comments:By: Tilghman Lesher (tilghman) 2008-04-18 01:27:14

Actually, in trunk, it's been updated to a dialplan function, CALLINGPRES(<name>), which uses the text in both cases.

By: Digium Subversion (svnbot) 2008-04-18 01:44:20

Repository: asterisk
Revision: 114242

U   branches/1.4/apps/app_setcallerid.c

------------------------------------------------------------------------
r114242 | tilghman | 2008-04-18 01:44:16 -0500 (Fri, 18 Apr 2008) | 3 lines

For consistency sake, ensure that the values that ${CALLINGPRES} returns are valid as an
input to SetCallingPres.  (Closes issue ASTERISK-11874)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=114242

By: Tilghman Lesher (tilghman) 2008-04-18 01:47:44

Just to clarify and for future reference, I used sscanf instead of strtol, because sscanf can tell the difference between an error and 0.  This is especially important, here, as 0 is a valid value for presentation.

By: Digium Subversion (svnbot) 2008-04-18 01:48:47

Repository: asterisk
Revision: 114243

_U  trunk/
U   trunk/apps/app_setcallerid.c

------------------------------------------------------------------------
r114243 | tilghman | 2008-04-18 01:48:44 -0500 (Fri, 18 Apr 2008) | 11 lines

Merged revisions 114242 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114242 | tilghman | 2008-04-18 01:49:16 -0500 (Fri, 18 Apr 2008) | 3 lines

For consistency sake, ensure that the values that ${CALLINGPRES} returns are valid as an
input to SetCallingPres.  (Closes issue ASTERISK-11874)

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=114243

By: Digium Subversion (svnbot) 2008-04-18 01:49:27

Repository: asterisk
Revision: 114244

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_setcallerid.c

------------------------------------------------------------------------
r114244 | tilghman | 2008-04-18 01:49:25 -0500 (Fri, 18 Apr 2008) | 19 lines

Merged revisions 114243 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r114243 | tilghman | 2008-04-18 01:53:47 -0500 (Fri, 18 Apr 2008) | 11 lines

Merged revisions 114242 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114242 | tilghman | 2008-04-18 01:49:16 -0500 (Fri, 18 Apr 2008) | 3 lines

For consistency sake, ensure that the values that ${CALLINGPRES} returns are valid as an
input to SetCallingPres.  (Closes issue ASTERISK-11874)

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=114244