Flows Campaigns



Outbound

Agent with Hardphone



2 Step call, calls the agent and when answered calls the destination.





${OUTGUID}: Guid of the call ${OUTAGENT}: Agent Name ${OUTQUEUE}: Campaign Name (Queue) ${OUTDID}: DID to use as callerid ${OUDIDALED}: Dialed Number



With Webrtc phone

The call do not need two steps, it is directly. The name of the queue, the guid, and the did can be obtained of the SIP Header, the rest of the variables can be obtained directly.

${SIP_HEADER(OUTGUID)}: Guid of the call ${CDR(accountcode)}: Agent Name ${SIP_HEADER(OUTQUEUE)}: Campaign Name (Queue) ${SIP_HEADER(OUTDID)}: DID to use as callerid ${EXTEN}: Dialed Number





Full Example of the Standard Workflow



We can see the variables running and are taken into account as they arrive depending on the mode that the agent to run.

Always set __Ani to be able to find calls in logs.

QueueUpdate always for update the values on Outbound campaigns.

 Set(CDR(userfield)=${userfield})  to Tag recording



exten=> _9XXXXXXX.,1,Set(VOLUME(TX)=2) exten=> _9XXXXXXX.,2,Set(VOLUME(RX)=2) exten=> _9XXXXXXX.,3,GotoIf($[${EXTEN:0:3}= 900]?62:4) exten=> _9XXXXXXX.,4,GotoIf($["${OUTQUEUE}"= ""]?47:5) exten=> _9XXXXXXX.,5,Set(__OUTQUEUE=${OUTQUEUE}) exten=> _9XXXXXXX.,6,Set(__DIALED=${OUTDIALED}) exten=> _9XXXXXXX.,7,Set(__AGENT=${OUTAGENT}) exten=> _9XXXXXXX.,8,Set(CALLERID(num)=${OUTDID}) exten=> _9XXXXXXX.,9,Set(CALLERID(name-pres)=allowed_passed_screen) exten=> _9XXXXXXX.,10,Set(HASH(Result)=${ODBC_Data(select did\,name\,dialstring from queues where name in (select queue_name from queue_members where membername = '${CHANNEL(accountcode)}') and direction = 'Outbound' and name ='${OUTQUEUE}')}) exten=> _9XXXXXXX.,11,Set(CALLERID(name)=${OUTQUEUE}) exten=> _9XXXXXXX.,12,Set(event=${ODBC_Data(select event from queue_log where agent = '${AGENT}' and queuename= '${OUTQUEUE}' and event in ('PAUSE', 'UNPAUSE') ORDER BY id DESC LIMIT 1)}) exten=> _9XXXXXXX.,13,GotoIf($["${event}" = "PAUSE"]?45:14) exten=> _9XXXXXXX.,14,GotoIf($["${OUTGUID}" = ""]?40:15) exten=> _9XXXXXXX.,15,Set(__guid=${OUTGUID}) exten=> _9XXXXXXX.,16,Set(CDR(guid)=${guid}) exten=> _9XXXXXXX.,17,Set(CDR(type)=record) exten=> _9XXXXXXX.,18,MixMonitor(${guid}.gsm,b,) exten=> _9XXXXXXX.,19,Set(CDR(campaign)=${OUTQUEUE}) exten=> _9XXXXXXX.,20,Set(CHANNEL(accountcode)=${AGENT}) exten=> _9XXXXXXX.,21,Set(__idLlamada=${guid}) exten=> _9XXXXXXX.,22,Set(__REALDIALED=${EXTEN:1}) exten=> _9XXXXXXX.,23,Set(existeNum=${ODBC_Data(SELECT COUNT(*) FROM black_list WHERE (campaign like '${OUTQUEUE}%' || campaign ='*') AND phone ='${EXTEN}')}) exten=> _9XXXXXXX.,24,GotoIf($["${existeNum}"!= "0"]?37:25) exten=> _9XXXXXXX.,25,Dial(${HASH(Result,dialstring)}/${EXTEN:1},180,TKkc,) exten=> _9XXXXXXX.,26,Set(CDR(causecode)=${HANGUPCAUSE}) exten=> _9XXXXXXX.,27,NoOp(${DIALSTATUS} - ${HANGUPCAUSE}) exten=> _9XXXXXXX.,28,GotoIf($["${DIALSTATUS}" = "BUSY"]?35:29) exten=> _9XXXXXXX.,29,GotoIf($["${DIALSTATUS}" = "CONGESTION"]?35:30) exten=> _9XXXXXXX.,30,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?33:31) exten=> _9XXXXXXX.,31,GotoIf($["${DIALSTATUS}" = "CANCEL"]?33:32) exten=> _9XXXXXXX.,32,Hangup() exten=> _9XXXXXXX.,33,Playback(outofservice,) exten=> _9XXXXXXX.,34,Goto(agentes,${EXTEN},32) exten=> _9XXXXXXX.,35,Playback(busy,) exten=> _9XXXXXXX.,36,Goto(agentes,${EXTEN},32) exten=> _9XXXXXXX.,37,Set(dummy=${ODBC_Repo(INSERT INTO black_list_history(calldate\,src\,dst) VALUES (now()\,'${AGENT}'\,'${EXTEN}'))}) exten=> _9XXXXXXX.,38,Playback(DNCRaudio,) exten=> _9XXXXXXX.,39,Goto(agentes,${EXTEN},32) exten=> _9XXXXXXX.,40,GotoIf($["${SIP_HEADER(OUTGUID)}" = ""]?43:41) exten=> _9XXXXXXX.,41,Set(__guid=${SIP_HEADER(OUTGUID)}) exten=> _9XXXXXXX.,42,Goto(agentes,${EXTEN},16) exten=> _9XXXXXXX.,43,GUID(__guid) exten=> _9XXXXXXX.,44,Goto(agentes,${EXTEN},16) exten=> _9XXXXXXX.,45,Playback(pausaerror,) exten=> _9XXXXXXX.,46,Hangup() exten=> _9XXXXXXX.,47,GotoIf($[$["${SIP_HEADER(OUTQUEUE)}"= ""]|$["${SIP_HEADER(OUTQUEUE)}"= "null"]]?53:48) exten=> _9XXXXXXX.,48,Set(__AGENT=${CHANNEL(accountcode)}) exten=> _9XXXXXXX.,49,Set(__DIALED=${EXTEN}) exten=> _9XXXXXXX.,50,Set(__OUTQUEUE=${SIP_HEADER(OUTQUEUE)}) exten=> _9XXXXXXX.,51,Set(CALLERID(num)=${SIP_HEADER(OUTDID)}) exten=> _9XXXXXXX.,52,Goto(agentes,${EXTEN},9) exten=> _9XXXXXXX.,53,Set(HASH(Result)=${ODBC_Data(select did\,name\,dialstring from queues where name in (select queue_name from queue_members where membername = '${CHANNEL(accountcode)}') and direction = 'Outbound')}) exten=> _9XXXXXXX.,54,GotoIf($["${HASH(Result,name)}"= ""]?60:55) exten=> _9XXXXXXX.,55,Set(__AGENT=${CHANNEL(accountcode)}) exten=> _9XXXXXXX.,56,Set(__DIALED=${EXTEN}) exten=> _9XXXXXXX.,57,Set(__OUTQUEUE=${HASH(Result,name)}) exten=> _9XXXXXXX.,58,Set(CALLERID(num)=${HASH(Result,did)}) exten=> _9XXXXXXX.,59,Goto(agentes,${EXTEN},9) exten=> _9XXXXXXX.,60,Background(llamadasincola,,,) exten=> _9XXXXXXX.,61,Hangup() exten=> _9XXXXXXX.,62,Set(inter-var=${DB(${CALLERID(num)}/INTER)}) exten=> _9XXXXXXX.,63,GotoIf($["${inter-var}" = "TRUE"]?4:64) exten=> _9XXXXXXX.,64,Playback(disabled-INTER,) exten=> _9XXXXXXX.,65,Hangup() exten=> h,1,Set(HASH(rates)=${ODBC_Data(select rates.gateway\, rates.rate\, rates.cost\, rates.note FROM rates LEFT JOIN provider ON provider.name=rates.gateway WHERE provider.status = 'true' AND substring( '${EXTEN}'\, 1\, length( prefix_regexp ) ) REGEXP prefix_regexp ORDER BY length(prefix_regexp) DESC\,rates.rate ASC)}) exten=> h,2,Set(talkedminutes=${MATH(${CDR(billsec)} / 60,f)}) exten=> h,3,Set(talkedminutes=$[CEIL(${talkedminutes})]) exten=> h,4,Set(chargedbalance=${MATH(${talkedminutes} * ${HASH(rates,rate)},f)}) exten=> h,5,Set(realbalance=${MATH(${talkedminutes} * ${HASH(rates,cost)},f)}) exten=> h,6,Set(CDR(charged_balance)=${chargedbalance}) exten=> h,7,Set(CDR(real_balance)=${realbalance}) exten=> h,8,Set(CDR(note)=${HASH(rates,note)}) exten=> h,9,Set(CDR(carrier)=${HASH(rates,gateway)}) exten=> h,10,Set(CDR(userfield)=${userfield}) exten=> h,11,Set(CDR(direction)=outgoing) exten=> h,12,Set(CDR(causecode)=${HANGUPCAUSE}) exten=> h,13,QueueUpdate(${OUTQUEUE},${UNIQUEID},${AGENT},${DIALSTATUS},${ANSWEREDTIME},${DIALEDTIME}|${DIALED}|${idLlamada})



When you create a campaign you define the Form or URL you want to display when you click in the Forms button in the agent for that campaigns.

Option 1:  uContact Form:  Name of the Form or  Name of the Form and | true (this to be able to close the Form Tab)

Example:  Codigos | true

                Codigos

Option 2: uContact URL:   URL and | name to show on the Tab or URL | name to show on the Tab  | true (this to be able to close the Form Tab)

Examples:   http://www.observador.com.uy | Observa

                 http://www.observador.com.uy | Observa | true

Inbound



Always set __Ani to be able to find calls in logs.

In SIP HEADER we set the CTI values this is persistent to all the call even when transfered if desired you can Remove the Header CTI.

Example



For hardphones auto answer set SIP Header: P-Auto-Answer: normal

SIPAddHeader set the Form or URL to PopUp in an incoming call .

Option 1:  uContact Form:   Name of the Form or   Name of the Form | true (this to be able to close the Tab)

Example:  Codigos

                Codigos | true





Option 2: uContact URL:   URL and | name to show on the Tab or URL | name to show on the Tab  | true (this to be able to close the Form Tab) (you can also concat variables on the URL example ${CALLERID(num)})

Examples:   http://www.observador.com.uy | Observa

                 http://www.observador.com.uy | Observa | true

          http://www.observador.com.uy/phone=${CALLERID(num)} | Observa | true





Advanced



Go first to an agent

  • Set penalization same as the phone number for each agent on that campaign.

  • Set strategy wrandom.

  • On the workflow set the following variables with the same number of the phone for the agent you want to go first. Set a Queue Rule on the Queue Activity name that is between  [] in  queuerules.conf.





  •  /etc/asterisk/queuerules.conf  add rule so the call is not always waiting for that agent and can move on the queue.



Means: 

Example