TUTORIAL CNAM Lookup for Outbound Calls

Rrrr

Tink
Joined
May 28, 2009
Messages
343
Reaction score
25
How can I dial-out a number and present back to the display of my IP phone the destination's name which can be found in
a) online databases
b) Asteridex phonebook?

Can Superfecta be used for this?

From WM: Jump to here for the FreePBX 2.11 solution.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
This has been looked at before - You're looking for Outbound Caller ID, like Reverse Caller ID of sorts. There's (or was) a thread here about it. Not sure if it made it through the Great Crash. It would really depend on the endpoint too.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
I've still got this running on a server at our house so I'll try to extract what was lost in The Great Crash. In the meantime, Philippe had some great ideas and a new way of doing this back in December, 2012:
Just wanted to follow up with you on our discussion today, your feedback was very useful concerning the proposed changes to CDR Reports as well as your feedback on the outbound CNAM lookups that you do. I will be putting a mechanism in place to allow code like yours to appropriately set the CNAM field. For now what I have done is to provide for a channel variable, OUTBOUND_CNAM_LOOKUP, to be set prior to macro-outbound-callerid being called. If that variable is not blank, then the CDR(outbound_cnam) field will be populated with it's contents vs. populating it with CALLERID(name). If your current hook does come before any of the other outbound code, then you would simply need to populate this channel variable for your value to take effect.

As mentioned, none of the CDR database fields will be affected, only new ones added and some re-arranging of the GUI report display as well as some of the search criteria. This mesa that any existing scripts and other tools that people may have written to process the CDR table will not be harmed.

I've also passed your suggestion to the folks maintaining the CID Lookup Module these days. If they were to hook outbound routes, as you suggested similar to inbound routes, then they could add a lookup that subsequently set the same channel variable and make this configurable in the GUI just like pin sets are hooked into outbound routes. So we'll see if they get interested in putting that in, it would actually be relatively straight forward since there are example modules like pin sets and call recording to copy and create similar hooks for.

Anyhow … just a quick thanks for the time and happy holidays!

Philippe
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Found it. Here is the code we currently are using with FreePBX 2.10 in extensions_override_freepbx.conf. The variable with the CNAM entry for the Outbound CallerID is ${var1}. You have your choice of AsteriDex or CallerID Superfecta lookups (don't forget to add your maint password!). Where it gets set in the CDR could be adjusted to display it on a phone as well...

WARNING: This has changed dramatically in FreePBX 2.11 as indicated in Philippe's note plus there appear to be major alterations in the way CallerID Superfecta works so this will have to be sorted out. See the post below for some working FreePBX 2.11 code.

Code:
[macro-outbound-callerid]
exten => s,1,ExecIf($["${CALLINGPRES_SV}" != ""]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
 
;--------- WM custom code starts here
exten => s,n,Noop(*** ${ARG2} ***)
exten => s,n,Set(num2find=${ARG2:-10})
 
; Use the 5 lines below for AsteriDex lookups
;exten => s,n,MYSQL(Connect connid localhost root passw0rd asteridex)
;exten => s,n,MYSQL(Query resultid ${connid} SELECT `name` FROM `user1` WHERE `out` = "${num2find}")
;exten => s,n,MYSQL(Fetch foundRow ${resultid} var1) ; fetch row
;exten => s,n,NoOp(*** ${var1} ***)
;exten => s,n,MYSQL(Disconnect ${connid})
 
; use the 3 lines below for CallerID Superfecta lookups
exten => s,n,Set(maintpw=yourMaintpasswordHERE)
exten => s,n,Set(CURLOPT(httptimeout)=7)
exten => s,n,Set(var1=${CURL(http://maint:${maintpw}@localhost:80/admin/modules/superfecta/bin/callerid.php?thenumber=${num2find})})
 
exten => s,n,NoOp(*** ${var1} ***)
 
exten => s,n,Set(CDR(accountcode,r)=${var1})
exten => s,n,Set(CALLERID(name)=${var1})
; ---------- WM custom code ends here
 
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = ""] | $["${KEEPCID}" != "TRUE"] | $["${OUTKEEPCID_${ARG1}}" = "on"] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($["foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}" = "foo"]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = "" | "${EMERGENCYCID:1:2}" = ""]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($[${LEN(${TRUNKOUTCID})} != 0]?Set(CALLERID(all)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(all)=${USEROUTCID}))
exten => s,n,ExecIf($[${LEN(${TRUNKCIDOVERRIDE})} != 0 | ${LEN(${FORCEDOUTCID_${ARG1}})} != 0]?Set(CALLERID(all)=${IF($[${LEN(${FORCEDOUTCID_${ARG1}})}=0]?${TRUNKCIDOVERRIDE}:${FORCEDOUTCID_${ARG1}})}))
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERPRES()=prohib_passed_screen))
 
;--== end of [macro-outbound-callerid] ==--;
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Good to see that at least one CNAM works. :001 9898: <-- type = Holy
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Here's the (quick-and-dirty) code to insert into extensions_overrride_freepbx.conf for FreePBX 2.11 in order to show CNAM info for outgoing calls in your CDRs. If you also want to display the info on your phone when you place an outbound call, enable the sendrpid setting for the desired extensions and then follow these steps from Philippe.

Restart Asterisk, and you should be good to go.

Code:
[macro-outbound-callerid]
 
;--------- WM custom code starts here
exten => s,1,Noop(*** Dial Number: ${DIAL_NUMBER} ***)
exten => s,n,Set(num2find=${DIAL_NUMBER:-10})
exten => s,n,Set(CALLERID(num)=${num2find})
 
; Use the 3 lines below for AsteriDex lookups but read the notes below first! Only works with Incredible PBX 11.
;exten => s,n,Set(USERDATA=${ODBC_ASTERIDEXCNAM(${num2find})})
;exten => s,n,Set(USER=${CUT(USERDATA,\,,1)})
;exten => s,n,Set(CALLERID(name)=${USER})
 
; use the 5 lines below for CallerID Superfecta lookups
exten => s,n,Set(CURLOPT(httptimeout)=7)
exten => s,n,Set(CIDSFSCHEME=YmFzZV9EZWZhdWx0)
exten => s,n,Set(lookupcid=${num2find})
exten => s,n,AGI(/var/www/html/admin/modules/superfecta/agi/superfecta.agi)
exten => s,n,Set(CALLERID(name)=${lookupcid})
 
exten => s,n,NoOp(*** Dial Name: ${CALLERID(name)} ***)
exten => s,n,Set(CDR(accountcode,r)=${CALLERID(name)})
; ---------- WM custom code ends here
 
exten => s,n,ExecIf($["${CALLINGPRES_SV}" != ""]?Set(CALLERPRES()=${CALLINGPRES_SV}))
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = ""]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n(start),GotoIf($[ $["${REALCALLERIDNUM}" = ""] | $["${KEEPCID}" != "TRUE"] | $["${OUTKEEPCID_${ARG1}}" = "on"] ]?normcid)
exten => s,n,Set(USEROUTCID=${REALCALLERIDNUM})
exten => s,n,GotoIf($["foo${DB(AMPUSER/${REALCALLERIDNUM}/device)}" = "foo"]?bypass)
exten => s,n(normcid),Set(USEROUTCID=${DB(AMPUSER/${AMPUSER}/outboundcid)})
exten => s,n(bypass),Set(EMERGENCYCID=${DB(DEVICE/${REALCALLERIDNUM}/emergency_cid)})
exten => s,n,Set(TRUNKOUTCID=${OUTCID_${ARG1}})
exten => s,n,GotoIf($["${EMERGENCYROUTE:1:2}" = "" | "${EMERGENCYCID:1:2}" = ""]?trunkcid)
exten => s,n,Set(CALLERID(all)=${EMERGENCYCID})
exten => s,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})
exten => s,n(exit),MacroExit()
exten => s,n(trunkcid),ExecIf($[${LEN(${TRUNKOUTCID})} != 0]?Set(CALLERID(all)=${TRUNKOUTCID}))
exten => s,n(usercid),ExecIf($[${LEN(${USEROUTCID})} != 0]?Set(CALLERID(all)=${USEROUTCID}))
exten => s,n,ExecIf($[${LEN(${TRUNKCIDOVERRIDE})} != 0 | ${LEN(${FORCEDOUTCID_${ARG1}})} != 0]?Set(CALLERID(all)=${IF($[${LEN(${FORCEDOUTCID_${ARG1}})}=0]?${TRUNKCIDOVERRIDE}:${FORCEDOUTCID_${ARG1}})}))
exten => s,n(hidecid),ExecIf($["${CALLERID(name)}"="hidden"]?Set(CALLERPRES()=prohib_passed_screen))
exten => s,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})
 
;--== end of [macro-outbound-callerid] ==--;
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
If you're using Incredible PBX 11 with Asterisk 11 and FreePBX 2.11, you can use AsteriDex lookups instead of CallerID Superfecta. Digium has dropped support for MySQL dialplan lookups so you have to do it with ODBC now. After logging into your server as root, execute the following commands to configure ODBC for AsteriDex phone number lookups:
Code:
echo " " >> /etc/asterisk/func_odbc.conf
echo "[ASTERIDEXCNAM]" >> /etc/asterisk/func_odbc.conf
echo "dsn=MySQL-asteridex" >> /etc/asterisk/func_odbc.conf
echo "read=SELECT `name` FROM `user1` WHERE `out`='${SQL_ESC(${ARG1})}'" >> /etc/asterisk/func_odbc.conf
echo " " >> /etc/asterisk/func_odbc.conf
amportal restart
Then you can uncomment the lines for AsteriDex lookups shown above. Be sure to comment out the CallerID Superfecta entries. Then reload your dialplan: asterisk -rx "dialplan reload"
 

Rrrr

Tink
Joined
May 28, 2009
Messages
343
Reaction score
25
Very nice, thank you. It does not show up in my originating phone yet.

Besides setting CIDSFSCHEME, I have made a small adjustment in line 2 to get number lookup to work (full number lookup, not limited to 10 positions):
Code:
exten => s,n,Set(num2find=${DIAL_NUMBER})

Now Superfecta finds a match in the Asteridex phonebook and assigns the name found to Dial Name:

-- Executing [s@macro-outbound-callerid:10] NoOp("SIP/224-00000006", "*** Dial Name: Holy Cow ***") in new stack

But it seems to reset CALLERID(name) somewhere to empty:
-- Executing [s@macro-outbound-callerid:9] NoOp("SIP/221-0000000f", "*** Dial Name: Holy Cow ***") in new stack
-- Executing [s@macro-outbound-callerid:10] Set("SIP/221-0000000f", "CDR(accountcode,r)=Holy Cow") in new stack
-- Executing [s@macro-outbound-callerid:11] ExecIf("SIP/221-0000000f", "0?Set(CALLERPRES()=)") in new stack
-- Executing [s@macro-outbound-callerid:12] ExecIf("SIP/221-0000000f", "0?Set(REALCALLERIDNUM=31123123123)") in new stack
-- Executing [s@macro-outbound-callerid:13] GotoIf("SIP/221-0000000f", "1?normcid") in new stack
-- Goto (macro-outbound-callerid,s,16)
-- Executing [s@macro-outbound-callerid:16] Set("SIP/221-0000000f", "USEROUTCID=31456456456") in new stack
-- Executing [s@macro-outbound-callerid:17] Set("SIP/221-0000000f", "EMERGENCYCID=") in new stack
-- Executing [s@macro-outbound-callerid:18] Set("SIP/221-0000000f", "TRUNKOUTCID=31456456456") in new stack
-- Executing [s@macro-outbound-callerid:19] GotoIf("SIP/221-0000000f", "1?trunkcid") in new stack
-- Goto (macro-outbound-callerid,s,24)
-- Executing [s@macro-outbound-callerid:24] ExecIf("SIP/221-0000000f", "1?Set(CALLERID(all)=31456456456)") in new stack
-- Executing [s@macro-outbound-callerid:25] ExecIf("SIP/221-0000000f", "1?Set(CALLERID(all)=31456456456)") in new stack
-- Executing [s@macro-outbound-callerid:26] ExecIf("SIP/221-0000000f", "1?Set(CALLERID(all)=31123123123)") in new stack
-- Executing [s@macro-outbound-callerid:27] ExecIf("SIP/221-0000000f", "0?Set(CALLERPRES()=prohib_passed_screen)") in new stack
-- Executing [s@macro-outbound-callerid:28] Set("SIP/221-0000000f", "CDR(outbound_cnum)=31123123123") in new stack
-- Executing [s@macro-outbound-callerid:29] Set("SIP/221-0000000f", "CDR(outbound_cnam)=") in new stack
...

Therefore I had to insert the 2nd line here at the bottom of [macro-outbound-callerid]:
Code:
exten => s,n,Set(CDR(outbound_cnum)=${CALLERID(num)})
exten => s,n,Set(CALLERID(name)=${lookupcid})
exten => s,n,Set(CDR(outbound_cnam)=${CALLERID(name)})

Now indeed the callerid(name) shows up in the CDR under
Outbound CallerID
eg "Holy Cow"<31123123123>, but not yet in my phone display.

The following lines in the log may help to show the reason:
-- Executing [s@macro-outbound-callerid:28] Set("SIP/221-00000015", "CDR(outbound_cnum)=31123123123") in new stack
-- Executing [s@macro-outbound-callerid:29] Set("SIP/221-00000015", "CALLERID(name)=Holy Cow") in new stack
-- Executing [s@macro-outbound-callerid:30] Set("SIP/221-00000015", "CDR(outbound_cnam)=Holy Cow") in new stack
-- Executing [s@macro-dialout-trunk:12] GosubIf("SIP/221-00000015", "1?sub-flp-2,s,1()") in new stack
..
-- Executing [s@macro-dialout-trunk:13] Set("SIP/221-00000015", "OUTNUM=31123123123") in new stack
-- Executing [s@macro-dialout-trunk:14] Set("SIP/221-00000015", "custom=SIP/RM010") in new stack
-- Executing [s@macro-dialout-trunk:15] ExecIf("SIP/221-00000015", "0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default))") in new stack
-- Executing [s@macro-dialout-trunk:16] ExecIf("SIP/221-00000015", "0?Set(DIAL_TRUNK_OPTIONS=M(confirm))") in new stack
-- Executing [s@macro-dialout-trunk:17] Macro("SIP/221-00000015", "dialout-trunk-predial-hook,") in new stack
-- Executing [s@macro-dialout-trunk-predial-hook:1] MacroExit("SIP/221-00000015", "") in new stack
-- Executing [s@macro-dialout-trunk:18] GotoIf("SIP/221-00000015", "0?bypass,1") in new stack
-- Executing [s@macro-dialout-trunk:19] ExecIf("SIP/221-00000015", "1?Set(CONNECTEDLINE(num,i)=31123123123)") in new stack
-- Executing [s@macro-dialout-trunk:20] ExecIf("SIP/221-00000015", "1?Set(CONNECTEDLINE(name,i)=CID:31123123123)") in new stack

I tried setting line 20 to a fixed value like eg. HOLY COW but still the outbound name did not show up in my display until I set sendrpid of the extension in Freepbx to Send Remote_part-ID header or to Send P-asserted-ID header
Which one is the best one to use?

Now indeed I see CID:31123123123 in the display of my phone as soon as the line is answered :)

I think there is an additional change needed in [macro-dialout-trunk] at line 20 to CONNECTEDLINE(name,i), do you have a suggestion? :(
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Rrrr: As you have found, this gets messy in a hurry. I'm reluctant to even document this until Philippe has time to have a look at it. But here goes...

First of all, this only works at all on some phones. We've tested it successfully on Yealink T46G, Grandstream GXP2200, and Cisco 7970. It doesn't work at all on Digium Phones or Mocet Communicator. Probably would work on Aastra phones, but I haven't tried it yet. Either of the sendrpid extension settings works on any of the phones I've tested if it works at all.

The basic call flow in FreePBX works like this but be advised that the dialplan code is different in every version of FreePBX. So you'd have to adjust this to match your version. An outbound call starts out in macro-user-callerid then hits sub-record-check and then macro-dialout-trunk. You'll find all of these in extensions_additional.conf. About 11 lines into macro-dialout-trunk, it runs macro-outbound-callerid. So far, so good. That's the piece we moved to extensions_override_freepbx.conf, and it's where we inserted our CNAM lookup code. As we've both discovered, that works fine if all you want to do is add the CallerID Name of the called party to the CDR.

If you want to actually display the CallerID Name of the called party on the phone once the call is connected, there's more. Further down in the macro-dialout-trunk context, you'll see another macro function call to macro-dialout-trunk-predial-hook. This was supposed to let you adjust the CallerID info (again) and then return to macro-dialout-trunk for completion of the call. Unfortunately, as presently written, if you Set(PREDIAL_HOOK_RET=BYPASS), then it basically hangs up your call when the macro exits and returns to macro-dialout-trunk. That's obviously not what we want.

What this means is you have to create [macro-dialout-trunk-predial-hook] in extensions_override_freepbx.conf as well. In that context...

(1) You've got to set the CallerID name properly:
Code:
exten => s,1,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
exten => s,n,Set(CONNECTEDLINE(name,i)=${var1})

(2) Then you've got to set the BYPASS flag:
Code:
exten => s,n,Set(PREDIAL_HOOK_RET=BYPASS)

(3) And then you've got to copy-and-paste the remainder of the macro-dialout-trunk code from below the call to macro-dialout-trunk-predial-hook (minus the two CONNECTEDLINE entries) into the bottom of macro-dialout-trunk-predial-hook. Otherwise, the outbound call just hangs up when the macro exits and returns to macro-dialout-trunk. The reason is the code currently jumps to the end of the context when BYPASS is detected rather than just jumping over the two CONNECTEDLINE entries.

(4) Finally, you've got to exit gracefully from the macro with MacroExit() at every spot where the code could end, i.e. at the end of the main code and at the end of each of the s-markers:
Code:
main code is here, then...
exten => s,n,MacroExit()
 
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s,n,MacroExit()
...

Like I said. It works, but it is U-G-L-Y. What would be preferable would be a goto/jump in macro-dialout-trunk over the two CONNECTEDLINE entries when the BYPASS flag was set or perhaps adding another flag for CNAMSET to just jump over the CONNECTEDLINE entries rather than jumping to the end of the context and hanging up the call. Then we could do this with 5 lines of code in extensions_override_freepbx.conf :
Code:
[macro-dialout-trunk-predial-hook]
exten => s,1,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
exten => s,n,Set(CONNECTEDLINE(name,i)=${var1})
exten => s,n,Set(PREDIAL_HOOK_RET=CNAMSET)
exten => s,n,MacroExit()

I'll pass this along to Philippe for further review.
 

Rrrr

Tink
Joined
May 28, 2009
Messages
343
Reaction score
25
Thanks, I take the advice and wait a bit till the elegant solution is available.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
I have continued my playing with Superfecta 2.11.x trying to properly invoke Superfecta lookups directly from the dial plan. I have not had much success, because the code is complicated and superfecta.agi is specifically tailored to perform lookups on inbound caller ID. The following lines seem to work consistently in my testing, but I would not be surprised if they require a bit of tweaking:


Did the code above not work for you??
 
Joined
Dec 13, 2007
Messages
59
Reaction score
1
Rrrr: As you have found, this gets messy in a hurry. I'm reluctant to even document this until Philippe has time to do some more work on it. But here goes...

First of all, this only works at all on some phones. We've tested it successfully on Yealink T46G, Grandstream GXP2200, and Cisco 7970. It doesn't work at all on Digium Phones or Mocet Communicator. Probably would work on Aastra phones, but I haven't tried it yet. Either of the sendrpid extension settings works on any of the phones I've tested if it works at all.

The basic call flow in FreePBX works like this but be advised that the dialplan code is different in every version of FreePBX. So you'd have to adjust this to match your version. An outbound call starts out in macro-user-callerid then hits sub-record-check and then macro-dialout-trunk. You'll find all of these in extensions_additional.conf. About 11 lines into macro-dialout-trunk, it runs macro-outbound-callerid. So far, so good. That's the piece we moved to extensions_override_freepbx.conf, and it's where we inserted our CNAM lookup code. As we've both discovered, that works fine if all you want to do is add the CallerID Name of the called party to the CDR.

If you want to actually display the CallerID Name of the called party on the phone once the call is connected, there's more. Further down in the macro-dialout-trunk context, you'll see another macro function call to macro-dialout-trunk-predial-hook. This was supposed to let you adjust the CallerID info (again) and then return to macro-dialout-trunk for completion of the call. Unfortunately, as presently written, if you Set(PREDIAL_HOOK_RET=BYPASS), then it basically hangs up your call when the macro exits and returns to macro-dialout-trunk. That's obviously not what we want.

What this means is you have to create [macro-dialout-trunk-predial-hook] in extensions_override_freepbx.conf as well. In that context...

(1) You've got to set the CallerID name properly:
Code:
exten => s,1,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
exten => s,n,Set(CONNECTEDLINE(name,i)=${var1})

(2) Then you've got to set the BYPASS flag:
Code:
exten => s,n,Set(PREDIAL_HOOK_RET=BYPASS)

(3) And then you've got to copy-and-paste the remainder of the macro-dialout-trunk code from below the call to macro-dialout-trunk-predial-hook (minus the two CONNECTEDLINE entries) into the bottom of macro-dialout-trunk-predial-hook. Otherwise, the outbound call just hangs up when the macro exits and returns to macro-dialout-trunk. The reason is the code currently jumps to the end of the context when BYPASS is detected rather than just jumping over the two CONNECTEDLINE entries.

(4) Finally, you've got to exit gracefully from the macro with MacroExit() at every spot where the code could end, i.e. at the end of the main code and at the end of each of the s-markers:
Code:
main code is here, then...
exten => s,n,MacroExit()
 
exten => s-BUSY,1,Noop(Dial failed due to trunk reporting BUSY - giving up)
exten => s-BUSY,n,Playtones(busy)
exten => s-BUSY,n,Busy(20)
exten => s,n,MacroExit()
...

Like I said. It works, but it is U-G-L-Y. What would be preferable would be a goto/jump in macro-dialout-trunk over the two CONNECTEDLINE entries when the BYPASS flag was set or perhaps adding another flag for CNAMSET to just jump over the CONNECTEDLINE entries rather than jumping to the end of the context and hanging up the call. Then we could do this with 5 lines of code in extensions_override_freepbx.conf :
Code:
[macro-dialout-trunk-predial-hook]
exten => s,1,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
exten => s,n,Set(CONNECTEDLINE(name,i)=${var1})
exten => s,n,Set(PREDIAL_HOOK_RET=CNAMSET)
exten => s,n,MacroExit()

I'll pass this along to Philippe for further review.
Ward have a look at the Advanced Settings: "Display CallerID On Calling Phone" and "Display Dialed Number on Calling Phone" if you don't want those CONNECTEDLINE() commands generated in macro-dialout-trunk, seems like that will address your problem if I understand it correctly:)
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
You da man, Philippe.

To get outbound CNAM to display on some* phones, in FreePBX Settings -> Advanced Settings, set both of these to False...

BUEhXhiCIAApJq4.jpg:large


NOTE: This isn't as weird as it appears. We're really just telling FreePBX that we don't want FreePBX to display CallerID and Dialed Number info on the Calling Phone, i.e. we want to do it ourselves.

We then can trim down the macro-dialout-trunk-predial-hook context and insert it into extensions_override_free.conf so it looks like this:
Code:
[macro-dialout-trunk-predial-hook]
exten => s,1,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
;exten => s,n,Set(CONNECTEDLINE(name,i)=${USER})      ; for AsteriDex
exten => s,n,Set(CONNECTEDLINE(name,i)=${lookupcid})  ; for CallerID Superfecta
exten => s,n,MacroExit()

_______________________
* Just to repeat for the sake of clarity: This only works on some phones. We've tested it successfully on Yealink T46G, Grandstream GXP2200, and Cisco 7970. It doesn't work at all on Digium Phones or Mocet Communicator. Probably would work on Aastra phones, but I haven't tried it yet. Either of the sendrpid extension settings works on any of the phones I've tested if it works at all.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Please report other phones on which the CNAM display works.
 

Rrrr

Tink
Joined
May 28, 2009
Messages
343
Reaction score
25
:clap:
Yealink T26 working
Siemens Gigaset S685IP and Sinus 501V working with sendrpid set to P_Asserted_Identity
 

Rrrr

Tink
Joined
May 28, 2009
Messages
343
Reaction score
25
PS One thing which would be nice if somehow the phone could store the OUTCNAM in call history.
This way, one could look at call history on the phone and simply redial a persons name, rather than figuring out which number belongs to the person you want to reach.
 
Joined
Dec 13, 2007
Messages
59
Reaction score
1
You da man, Philippe.

To get outbound CNAM to display on some* phones, in FreePBX Settings -> Advanced Settings, set both of these to False...

BUEhXhiCIAApJq4.jpg:large


NOTE: This isn't as weird as it appears. We're really just telling FreePBX that we don't want FreePBX to display CallerID and Dialed Number info on the Calling Phone, i.e. we want to do it ourselves.

We then can trim down the macro-dialout-trunk-predial-hook context and insert it into extensions_override_free.conf so it looks like this:
Code:
[macro-dialout-trunk-predial-hook]
exten => s,1,Set(CONNECTEDLINE(num,i)=${DIAL_NUMBER})
;exten => s,n,Set(CONNECTEDLINE(name,i)=${USER})      ; for AsteriDex
exten => s,n,Set(CONNECTEDLINE(name,i)=${lookupcid})  ; for CallerID Superfecta
exten => s,n,MacroExit()

_______________________
* Just to repeat for the sake of clarity: This only works on some phones. We've tested it successfully on Yealink T46G, Grandstream GXP2200, and Cisco 7970. It doesn't work at all on Digium Phones or Mocet Communicator. Probably would work on Aastra phones, but I haven't tried it yet. Either of the sendrpid extension settings works on any of the phones I've tested if it works at all.
I would use extensions_custom.conf over extensions_override_freepbx.conf for this. The macro-dialout=trunk-predial-hook is a hook that is always intended for the user to add custom things to. As such, we will never define it. The only time you want to use the override file is if you really have to override what we will be auto-generating. This will work the same in either file but it's a lot safer in the _custom file and easier to do 'bad' things when using the override file. Just fyi :)
 

Rrrr

Tink
Joined
May 28, 2009
Messages
343
Reaction score
25
I have no /etc/odbc.ini :innocent:
I created it with your content, but to no avail.
I guess I need to install an odbc module?
 

Members online

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top