Skip to content

Commit

Permalink
Adding exported vars to ring channel leg.
Browse files Browse the repository at this point in the history
  • Loading branch information
lordnull committed Apr 20, 2012
1 parent dda151b commit ba47ac0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions include_apps/oacd_freeswitch/src/freeswitch_media.erl
Expand Up @@ -301,7 +301,7 @@ handle_ring({Apid, #agent{ring_channel = {EndpointPid, persistant, _EndPointType
%% a persisitant ring does the hard work for us
%% go right to the okay.
?INFO("Ring channel made things happy, I assume", []),
{ok, [{"itext", State#state.ivroption}], Callrec#call{ring_path = inband, media_path = inband}, State#state{ringchannel = EndpointPid, agent_pid = Apid}};
{ok, [{"itxt", State#state.ivroption}], Callrec#call{ring_path = inband, media_path = inband}, State#state{ringchannel = EndpointPid, agent_pid = Apid}};
handle_ring({Apid, #agent{ring_channel = {RPid, transient, _}} = AgentRec}, _RingData, Callrec, State) ->
NewStatename = case State#state.statename of
inqueue -> inqueue_ringing;
Expand Down Expand Up @@ -1003,7 +1003,7 @@ case_event_name("CHANNEL_PARK", UUID, Rawcall, Callrec, #state{
uuid = UUID, queued = false, statename = Statename} = State) when
Statename == inivr ->
Queue = proplists:get_value("variable_queue", Rawcall, "default_queue"),
Client = {proplists:get_value("variable_brand", Rawcall),get_client_options(Rawcall)},
Client = {proplists:get_value("variable_brand", Rawcall),[{"dial_vars", State#state.dial_vars} | get_client_options(Rawcall)]},
AllowVM = proplists:get_value("variable_allow_voicemail", Rawcall, false),
Moh = case proplists:get_value("variable_queue_moh", Rawcall, "moh") of
"silence" ->
Expand Down
15 changes: 8 additions & 7 deletions include_apps/oacd_freeswitch/src/freeswitch_ring.erl
Expand Up @@ -270,17 +270,18 @@ init([Fsnode, #callbacks{init = InitFun} = Callbacks, Options]) ->
case freeswitch:api(Fsnode, create_uuid) of
{ok, UUID} ->
Callrec = proplists:get_value(call, Options),
{CallerName, CallerNumber, Dnis, Ringout} = case Callrec of
{CallerName, CallerNumber, Dnis, Ringout, DefaultDailOpts} = case Callrec of
#call{callerid = {Cname, Cnumber}, dnis = TheDnis, client = Client} ->
RingoutTime = case Client of
undefined -> 60;
_ -> proplists:get_value("ringout",Client#client.options,60)
{RingoutTime, DOpts} = case Client of
undefined -> {60,[]};
_ -> {proplists:get_value("ringout",Client#client.options,60),
proplists:get_value("dial_vars", Client#client.options, [])}
end,
{Cname, Cnumber, TheDnis, RingoutTime};
{Cname, Cnumber, TheDnis, RingoutTime, DOpts};
undefined ->
TheDnis = proplists:get_value(dnis, Options, "0000000"),
{Cname, Cnumber} = proplists:get_value(caller_id, Options, {"noname", "nonumber"}),
{Cname, Cnumber, TheDnis, 60}
{Cname, Cnumber, TheDnis, 60, []}
end,
HangupAfterBridge = case proplists:get_value(persistent, Options) of
true -> "false";
Expand All @@ -298,7 +299,7 @@ init([Fsnode, #callbacks{init = InitFun} = Callbacks, Options]) ->
"origination_uuid="++UUID,
"originate_timeout="++integer_to_list(round(Ringout)),
"sip_h_X-DNIS='"++Dnis++"'"
| proplists:get_value(dial_vars, Options, [])],
| proplists:get_value(dial_vars, Options, DefaultDailOpts)],
case InitFun({Fsnode, UUID}, Options) of
{ok, NewDialStringOpts, CallbackState} ->
DialStringOpts = NewDialStringOpts ++ PreInitDialStringOpts,
Expand Down

0 comments on commit ba47ac0

Please sign in to comment.