Sorry to post the code below but I can’t create a new ticket on the FreePBX Trac web site like I used to. Now it seems that “TICKET_CREATE_SIMPLE privileges are required to perform this operation”.
I would like to have some feedback from the developers and users regarding DUNDi setups similar to what I described above.
I seem to have the basics working (even ring groups) but I’m having some minor issues with CDRs.
The thing I really would like to solve is:
CDR (as taken from the reports page) on pbx2 where ext. 4053 is calling to ring group 4051:
-
2008-02-28 16:51:29 SIP/4053-b... 7021 "VIERI" <7021> 4051 Dial... IAX2/priv:... ANSWERED 01:11 01:09
CDR on pbx1 where ext. 4065 which is a member of 4051 is being reached:
-
2008-02-28 16:52:52 IAX2/priv-... 7021 "VIERI" <7021> 4065 ResetCDR... w... ANSWERED 00:09 00:04
-
2008-02-28 16:52:44 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
-
2008-02-28 16:52:35 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
-
2008-02-28 16:52:26 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
-
2008-02-28 16:52:18 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
-
2008-02-28 16:52:09 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
-
2008-02-28 16:52:00 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
-
2008-02-28 16:51:51 IAX2/priv-... 7021 "VIERI" <7021> 4065 Busy... 20... BUSY 00:00 00:00
Never mind the slight clock skew between pbx1 and pbx2.
The CDR “problem” I see is that pbx1 is reporting that my extension 4053 (aliased 7021) is trying to reach ext. 4065 but I actually dialed 4051 which is the ring group as seen in the CDR of PBX2.
How can I “tell” (and “when”) pbx1 that its CDR must relate somehow to the group 4051. I know that its logical that it logs the final ext. 4065 because that’s what’s performed but the GoTo in the macro-dundi generated by FreePBX. However, I would like to know if I can “tag” it somehow with the original dst (or relate it easily by doing a cross SQL query between the 2 servers).
Finally, could the developers please let me know if they are willing to consider the following “code logic” for future releases (ie. modify the “dial logic” so as to include DUNDi lookups)?
--- extensions.conf_ORIG 2008-02-28 18:39:20.000000000 +0100
+++ extensions.conf 2008-02-28 18:39:17.000000000 +0100
@@ -70,7 +70,11 @@
exten => s,n(dial),AGI(dialparties.agi)
exten => s,n,NoOp(Returned from dialparties with no extensions to call and DIALSTATUS: ${DIALSTATUS})
-exten => s,n+2(normdial),Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null
+exten => s,n+2(normdial),Set(EXTTODIAL=${CUT(ds|&|1)})
+exten => s,n,NoOp(DUNDi lookup ${EXTTODIAL} extracted from ${ds})
+exten => s,n,Macro(local-or-dundi,${EXTTODIAL},4)
+exten => s,n,NoOp(DUNDi did not find ${EXTTODIAL}. Going local.)
+exten => s,n,Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null
exten => s,n,Set(DIALSTATUS=${IF($["${DIALSTATUS_CW}"!="" ]?${DIALSTATUS_CW}:${DIALSTATUS})})
exten => s,20(huntdial),NoOp(Returned from dialparties with hunt groups to dial )
@@ -97,7 +101,10 @@
exten => s,n,Set(CTLoop=$[1 + ${CTLoop}])
exten => s,n,Goto(s,a37)
-exten => s,n(a42),Dial(${${HuntMember}}${ds})
+exten => s,n(a42),NoOp(DUNDi lookup ${${HuntMember}})
+exten => s,n,Macro(local-or-dundi,${${HuntMember}},4)
+exten => s,n,NoOp(DUNDi did not find ${${HuntMember}}. Going local.)
+exten => s,n,Dial(${${HuntMember}}${ds})
exten => s,n,Set(HuntLoop=$[1 + ${HuntLoop}])
exten => s,n,GotoIf($[$[$[“foo${RingGroupMethod}” != “foofirstavailable”] & $[“foo${RingGroupMethod}” != “foofirstnotonphone”]] | $[“foo${DialStatus}” = “fooBUSY”]]?a46)
exten => s,n,Set(HuntMembers=0)
In sip_registrations_custom.conf:
regcontext=dundi-extens
In extensions_custom.conf:
[macro-local-or-dundi]
exten => s,1,Set(CHANTOCALL=${ARG1})
exten => s,2,Set(EXTTOCALL=${CUT(CHANTOCALL|/|2})
exten => s,3,Set(DUNDIMAP=${ARG2})
exten => s,4,ChanIsAvail(${CHANTOCALL}|sj)
exten => s,105,NoOp(DUNDi: ${CHANTOCALL} is not available locally. Calling ${EXTTOCALL} via dundi-${DUNDIMAP}.)
exten => s,106,Macro(user-callerid,SKIPTTL,)
exten => s,107,Macro(record-enable,${EXTTOCALL},IN)
exten => s,108,AGI(fixlocalprefix)
exten => s,109,Macro(dundi-${DUNDIMAP},${EXTTOCALL}) ; use DUNDi if channel is unavailable
exten => s,110,Macro(hangupcall)
[dundi-incoming]
include => from-internal
In FreePBX I created a DUNDi trunk with priv mapping and a IAX2 trunk.
iax_additional.conf:
[priv]
type=friend
dbsecret=dundi/secret
context=dundi-incoming
dundi.conf:
[general]
entityid=00:1D:60:39:E9:1B
cachetime=5
ttl=2
autokill=yes
[mappings]
priv => dundi-extens,0,IAX2,priv:${SECRET}@192.168.250.128/${NUMBER},nopartial
[00:1D:60:B0:25:10]
model = symmetric
host = 192.168.250.27
inkey = dundi
outkey = dundi
include = priv
permit = priv
qualify = yes
order = primary
Would really appreciate some feedback.
Regards,
Vieri