Skip to content

Commit

Permalink
sms defaults for outbound options and reschedule
Browse files Browse the repository at this point in the history
  • Loading branch information
lazedo committed Sep 15, 2015
1 parent 4f240df commit 8a2a247
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion applications/doodle/priv/couchdb/reschedule.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"no_route": {
"error": {
"reason": [
"NO_ROUTE_DESTINATION"
"NO_ROUTE"
]
},
"interval": {
Expand Down
8 changes: 7 additions & 1 deletion core/whistle-1.0.0/src/api/wapi_sms.erl
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@
,(amqp_util:encode(CallId))/binary
>>).

-define(SMS_DEFAULT_OUTBOUND_OPTIONS, wh_json:from_list([{<<"delivery_mode">>, 2}
,{<<"mandatory">>, 'true'}
])).
-define(SMS_OUTBOUND_OPTIONS_KEY, [<<"outbound">>, <<"options">>]).
-define(SMS_OUTBOUND_OPTIONS, whapps_config:get(<<"sms">>, ?SMS_OUTBOUND_OPTIONS_KEY, ?SMS_DEFAULT_OUTBOUND_OPTIONS)).

-spec message(api_terms()) -> api_formatter_return().
message(Prop) when is_list(Prop) ->
EPs = [begin
Expand Down Expand Up @@ -397,7 +403,7 @@ publish_outbound(Req, ContentType) ->
RouteId = props:get_value(<<"Route-ID">>, Req, <<"*">>),
Exchange = props:get_value(<<"Exchange-ID">>, Req, ?SMS_EXCHANGE),
RK = ?OUTBOUND_ROUTING_KEY(RouteId, MessageId),
Opts = amqp_options(whapps_config:get(<<"sms">>, [<<"outbound">>, <<"options">>])),
Opts = amqp_options(?SMS_OUTBOUND_OPTIONS),
amqp_util:basic_publish(Exchange, RK, Payload, ContentType, Opts).

-spec publish_delivery(api_terms()) -> 'ok'.
Expand Down

0 comments on commit 8a2a247

Please sign in to comment.