[Amportal-devel] [PATCH] Expose dial and dialout events to e

It would be convenient for some users to be able to react to dialing
events without having to hack extensions.conf.

NOTE: This patch depends on the the dialparties patches I submitted
earlier today.

Right now, this patch exposes the following events to

custom-dial-starting (before Dial() is executed)
custom-dial-answered (call has been answered)
custom-dial-ended (call has been ended)

custom-dialout-starting (before Dial() is executed)
custom-dialout-answered (call has been answered)
custom-dialout-ended (call has ended)

The events can be captured by defining macros in extensions_custom.conf
with the event names listed above:

exten => s,1,NoOp(“Incoming or Internal call has completed”)

exten => s,1,NoOp(“About to dial out”)

I think it would be nice to see other events exposed, such as “Voicemail
Left”, “Fax Sent”, and “Fax Received”, but I’d like some input before
devoting anymore energy to this. What events would everyone else like
to see, and at what point in the dialplan should they be exposed?

I’m aware that there are other dialout and dial events that are not
exposed by this patch. I’ve tested this with the dialplan we use, which
is admittedly pretty simple. I’d like feedback from others about using
this with more complex dialing plans (follow-me, hunt groups, etc). Is
this generating events appropriately?

Is this idea even something that should be included in freepbx? I think
so, because the more power we expose to extensions_custom.conf, the
fewer reasons anyone has for messing with extensions.conf and the
smoother future upgrades will be.

Let me know what you think,

Jeff Doozan

— extensions.conf 2007-02-23 12:35:03.333382472 -0500
+++ extensions.conf.new 2007-02-23 14:09:01.519247936 -0500
@@ -54,7 +54,8 @@
exten => s,2,NoOp(Returned from dialparties with no extensions to call)
exten => s,3,NoOp(DIALSTATUS is ‘${DIALSTATUS}’)

-exten => s,10,Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null
+exten => s,10,Macro(custom-dial-started)
+exten => s,11,Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null

exten => s,20,NoOp(Returned from dialparties with hunt groups to dial )
exten => s,21,Set(HuntLoop=0)
@@ -75,16 +76,18 @@
exten => s,40,Set(CTLoop=$[1 + ${CTLoop}])
exten => s,41,Goto(s,37)

-exten => s,42,Dial(${${HuntMember}}${ds} ) ; dialparties will set the priority to 20 if $ds is not null and its a hunt group
-exten => s,43,Set(HuntLoop=$[1 + ${HuntLoop}])
-exten => s,44,Set(HuntMembers=$[${HuntMembers} - 1])
-exten => s,45,Goto(s,22)
+exten => s,42,Macro(custom-dial-started)
+exten => s,43,Dial(${${HuntMember}}${ds} ) ; dialparties will set the priority to 20 if $ds is not null and its a hunt group
+exten => s,44,Set(HuntLoop=$[1 + ${HuntLoop}])
+exten => s,45,Set(HuntMembers=$[${HuntMembers} - 1])
+exten => s,46,Goto(s,22)
exten => s,50,DBdel(CALLTRACE/${CT_EXTEN})
exten => s,51,Goto(s,42)

; make sure hungup calls go here so that proper cleanup occurs from call confirmed calls and the like
-exten => h,1,Macro(hangupcall)
+exten => h,1,Macro(custom-dial-ended)
+exten => h,2,Macro(hangupcall)

; Macro called after the dial command has been answered
@@ -96,7 +99,7 @@
exten => s,n,Macro(${ARG${MacroLoop}})
exten => s,n,Set(MacroLoop=$[1 + ${MacroLoop}])
exten => s,n,Goto(loop)
-exten => s,n(end),NoOp(“dial-answered complete”)
+exten => s,n(end),Macro(custom-dial-answered)

; Ring an extension, if the extension is busy or there is no answer send it
@@ -389,6 +392,8 @@
exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)}) ; Custom trunks are prefixed with “AMP:“
exten => s,n,GotoIf($[”${custom}” = “AMP”]?customtrunk)
+exten => s,n,Macro(custom-dialout-started)
+exten => s,n,Set(DIAL_TRUNK_OPTIONS=${DIAL_TRUNK_OPTIONS}M(custom-dialout-answered))
exten => s,n,Dial(${OUT_${DIAL_TRUNK}}/${OUTNUM},300,${DIAL_TRUNK_OPTIONS}) ; Regular Trunk Dial
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n(customtrunk),Set(pre_num=${CUT(OUT_${DIAL_TRUNK},$,1)})
@@ -414,7 +419,8 @@

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS} - failing through to other trunks)

-exten => h,1,Macro(hangupcall)
+exten => h,1,Macro(custom-dialout-ended)
+exten => h,2,Macro(hangupcall)

; Adds a dynamic agent/member to a Queue
; Prompts for call-back number - in not entered, uses CIDNum

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash

Amportal-devel mailing list
[email protected]

Post generated using Mail2Forum (http://www.mail2forum.com)

Well I would like to know if a call can be reinvited or not due to the call path. Right now I am having issues with IVR > Queue > Extensions vs just IVR > Extensions since the Queue is adding an additional channel for the call path and therefore causes my inbound calls to stay bridged in * and not reinvite the RTP channel from A -> C.