Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

WHISTLE-1217: make Msg-ID a default header, and populate it when not …

…present
  • Loading branch information...
commit 392137cb35164a4a451543780d57e857fb660e51 1 parent 9070f0d
bitbashing k-anderson authored
23 lib/whistle-1.0.0/src/api/wapi_authn.erl
@@ -28,14 +28,13 @@
28 28 -define(EVENT_CATEGORY, <<"directory">>).
29 29 -define(AUTHN_REQ_EVENT_NAME, <<"authn_req">>).
30 30
31   --define(AUTHN_REQ_HEADERS, [<<"Msg-ID">>, <<"To">>, <<"From">>, <<"Orig-IP">>
  31 +-define(AUTHN_REQ_HEADERS, [<<"To">>, <<"From">>, <<"Orig-IP">>
32 32 , <<"Auth-User">>, <<"Auth-Realm">>]).
33 33 -define(OPTIONAL_AUTHN_REQ_HEADERS, [<<"Method">>, <<"Switch-Hostname">>]).
34 34 -define(AUTHN_REQ_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
35 35 ,{<<"Event-Name">>, ?AUTHN_REQ_EVENT_NAME}
36 36 ]).
37   --define(AUTHN_REQ_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
38   - ,{<<"To">>, fun is_binary/1}
  37 +-define(AUTHN_REQ_TYPES, [{<<"To">>, fun is_binary/1}
39 38 ,{<<"From">>, fun is_binary/1}
40 39 ,{<<"Orig-IP">>, fun is_binary/1}
41 40 ,{<<"Auth-User">>, fun is_binary/1}
@@ -43,27 +42,25 @@
43 42 ]).
44 43
45 44 %% Authentication Responses
46   --define(AUTHN_RESP_HEADERS, [<<"Msg-ID">>, <<"Auth-Method">>, <<"Auth-Password">>]).
  45 +-define(AUTHN_RESP_HEADERS, [<<"Auth-Method">>, <<"Auth-Password">>]).
47 46 -define(OPTIONAL_AUTHN_RESP_HEADERS, [<<"Tenant-ID">>, <<"Access-Group">>, <<"Custom-Channel-Vars">>]).
48 47 -define(AUTHN_RESP_VALUES, [{<<"Event-Category">>, <<"directory">>}
49 48 ,{<<"Event-Name">>, <<"authn_resp">>}
50 49 ,{<<"Auth-Method">>, [<<"password">>, <<"ip">>, <<"a1-hash">>, <<"error">>]}
51 50 ]).
52   --define(AUTHN_RESP_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
53   - ,{<<"Auth-Password">>, fun is_binary/1}
54   - ,{<<"Custom-Channel-Vars">>, fun wh_json:is_json_object/1}
55   - ,{<<"Access-Group">>, fun is_binary/1}
56   - ,{<<"Tenant-ID">>, fun is_binary/1}
57   - ]).
  51 +-define(AUTHN_RESP_TYPES, [{<<"Auth-Password">>, fun is_binary/1}
  52 + ,{<<"Custom-Channel-Vars">>, fun wh_json:is_json_object/1}
  53 + ,{<<"Access-Group">>, fun is_binary/1}
  54 + ,{<<"Tenant-ID">>, fun is_binary/1}
  55 + ]).
58 56
59 57 %% Authentication Failure Response
60   --define(AUTHN_ERR_HEADERS, [<<"Msg-ID">>]).
  58 +-define(AUTHN_ERR_HEADERS, []).
61 59 -define(OPTIONAL_AUTHN_ERR_HEADERS, []).
62 60 -define(AUTHN_ERR_VALUES, [{<<"Event-Category">>, <<"directory">>}
63 61 ,{<<"Event-Name">>, <<"authn_err">>}
64 62 ]).
65   --define(AUTHN_ERR_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
66   - ]).
  63 +-define(AUTHN_ERR_TYPES, []).
67 64
68 65 %%--------------------------------------------------------------------
69 66 %% @doc Authentication Request - see wiki
17 lib/whistle-1.0.0/src/api/wapi_authz.erl
@@ -33,7 +33,7 @@
33 33 -define(KEY_AUTHZ_IDENT_REQ, <<"authz.ident_req">>).
34 34
35 35 %% Authorization Requests
36   --define(AUTHZ_REQ_HEADERS, [<<"Msg-ID">>, <<"To">>, <<"From">>, <<"Call-ID">>
  36 +-define(AUTHZ_REQ_HEADERS, [<<"To">>, <<"From">>, <<"Call-ID">>
37 37 ,<<"Caller-ID-Name">>, <<"Caller-ID-Number">>
38 38 ,<<"Account-ID">>, <<"Request">>, <<"Usage">>
39 39 ]).
@@ -41,8 +41,7 @@
41 41 -define(AUTHZ_REQ_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
42 42 ,{<<"Event-Name">>, <<"req">>}
43 43 ]).
44   --define(AUTHZ_REQ_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
45   - ,{<<"To">>, fun is_binary/1}
  44 +-define(AUTHZ_REQ_TYPES, [{<<"To">>, fun is_binary/1}
46 45 ,{<<"From">>, fun is_binary/1}
47 46 ,{<<"Call-ID">>, fun is_binary/1}
48 47 ,{<<"Account-ID">>, fun is_binary/1}
@@ -53,7 +52,7 @@
53 52 ]).
54 53
55 54 %% Authorization Responses
56   --define(AUTHZ_RESP_HEADERS, [<<"Msg-ID">>, <<"Call-ID">>, <<"Is-Authorized">>]).
  55 +-define(AUTHZ_RESP_HEADERS, [<<"Call-ID">>, <<"Is-Authorized">>]).
57 56 -define(OPTIONAL_AUTHZ_RESP_HEADERS, [<<"Custom-Channel-Vars">>, <<"Type">>, <<"Global-Resource">>]).
58 57 -define(AUTHZ_RESP_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
59 58 ,{<<"Event-Name">>, <<"resp">>}
@@ -64,15 +63,14 @@
64 63 -define(AUTHZ_RESP_TYPES, [{<<"Custom-Channel-Vars">>, fun wh_json:is_json_object/1}]).
65 64
66 65 %% Authorization Identify Requests
67   --define(AUTHZ_IDENT_REQ_HEADERS, [<<"Msg-ID">>, <<"To">>, <<"From">>, <<"Request">>, <<"Call-ID">>
  66 +-define(AUTHZ_IDENT_REQ_HEADERS, [<<"To">>, <<"From">>, <<"Request">>, <<"Call-ID">>
68 67 ,<<"Caller-ID-Name">>, <<"Caller-ID-Number">>
69 68 ]).
70 69 -define(OPTIONAL_AUTHZ_IDENT_REQ_HEADERS, [<<"Custom-Channel-Vars">>]).
71 70 -define(AUTHZ_IDENT_REQ_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
72 71 ,{<<"Event-Name">>, <<"identify_req">>}
73 72 ]).
74   --define(AUTHZ_IDENT_REQ_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
75   - ,{<<"To">>, fun is_binary/1}
  73 +-define(AUTHZ_IDENT_REQ_TYPES, [{<<"To">>, fun is_binary/1}
76 74 ,{<<"From">>, fun is_binary/1}
77 75 ,{<<"Call-ID">>, fun is_binary/1}
78 76 ,{<<"Caller-ID-Name">>, fun is_binary/1}
@@ -81,14 +79,13 @@
81 79 ]).
82 80
83 81 %% Authorization Identify Responses
84   --define(AUTHZ_IDENT_RESP_HEADERS, [<<"Msg-ID">>, <<"Call-ID">>, <<"Account-ID">>]).
  82 +-define(AUTHZ_IDENT_RESP_HEADERS, [<<"Call-ID">>, <<"Account-ID">>]).
85 83 -define(OPTIONAL_AUTHZ_IDENT_RESP_HEADERS, [<<"Reseller-ID">>, <<"Global-Resource">>]).
86 84 -define(AUTHZ_IDENT_RESP_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
87 85 ,{<<"Event-Name">>, <<"identify_resp">>}
88 86 ,{<<"Global-Resource">>, [<<"true">>, <<"false">>]}
89 87 ]).
90   --define(AUTHZ_IDENT_RESP_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
91   - ,{<<"Call-ID">>, fun is_binary/1}
  88 +-define(AUTHZ_IDENT_RESP_TYPES, [{<<"Call-ID">>, fun is_binary/1}
92 89 ,{<<"Account-ID">>, fun is_binary/1}
93 90 ,{<<"Reseller-ID">>, fun is_binary/1}
94 91 ]).
5 lib/whistle-1.0.0/src/api/wapi_call.erl
@@ -47,8 +47,7 @@
47 47 %% Call Events
48 48 -define(CALL_EVENT_HEADERS, [<<"Call-ID">>]).
49 49 -define(OPTIONAL_CALL_EVENT_HEADERS, [<<"Application-Name">>, <<"Application-Response">>
50   - ,<<"Custom-Channel-Vars">>, <<"Timestamp">>
51   - ,<<"Msg-ID">>, <<"Channel-State">>
  50 + ,<<"Custom-Channel-Vars">>, <<"Timestamp">>, <<"Channel-State">>
52 51 ,<<"Call-Direction">>, <<"Transfer-History">>
53 52 ,<<"Other-Leg-Direction">>, <<"Other-Leg-Caller-ID-Name">>
54 53 ,<<"Other-Leg-Caller-ID-Number">>, <<"Other-Leg-Destination-Number">>
@@ -62,7 +61,7 @@
62 61 ,<<"Fax-Result-Text">>, <<"Fax-ECM-Used">>
63 62 ,<<"Fax-Transferred-Pages">>, <<"Fax-Total-Pages">>
64 63 ,<<"Fax-Bad-Rows">>, <<"Fax-Transfer-Rate">>
65   - ,<<"Msg-ID">>, <<"Switch-Hostname">>, <<"Group-ID">>
  64 + ,<<"Switch-Hostname">>, <<"Group-ID">>
66 65 ]).
67 66 -define(CALL_EVENT_VALUES, [{<<"Event-Category">>, <<"call_event">>}]).
68 67 -define(CALL_EVENT_TYPES, [{<<"Custom-Channel-Vars">>, fun wh_json:is_json_object/1}]).
7 lib/whistle-1.0.0/src/api/wapi_conference.erl
@@ -60,7 +60,7 @@
60 60
61 61 %% Conference Search Request
62 62 -define(SEARCH_REQ_HEADERS, [<<"Conference-ID">>]).
63   --define(OPTIONAL_SEARCH_REQ_HEADERS, [<<"Msg-ID">>]).
  63 +-define(OPTIONAL_SEARCH_REQ_HEADERS, []).
64 64 -define(SEARCH_REQ_VALUES, [{<<"Event-Category">>, <<"conference">>}
65 65 ,{<<"Event-Name">>, <<"search_req">>}
66 66 ]).
@@ -70,7 +70,8 @@
70 70 -define(SEARCH_RESP_HEADERS, [<<"Conference-ID">>, <<"Participant-Count">>, <<"Switch-Hostname">>]).
71 71 -define(OPTIONAL_SEARCH_RESP_HEADERS, [<<"Switch-URL">>, <<"Switch-External-IP">>, <<"Rate">>
72 72 ,<<"UUID">>, <<"Running">>, <<"Answered">>, <<"Dynamic">>
73   - ,<<"Run-Time">>, <<"Participants">>, <<"Locked">>, <<"Msg-ID">>]).
  73 + ,<<"Run-Time">>, <<"Participants">>, <<"Locked">>
  74 + ]).
74 75 -define(SEARCH_RESP_VALUES, [{<<"Event-Category">>, <<"conference">>}
75 76 ,{<<"Event-Name">>, <<"search_resp">>}
76 77 ]).
@@ -278,7 +279,7 @@
278 279
279 280 %% Conference Error
280 281 -define(CONFERENCE_ERROR_HEADERS, [<<"Error-Message">>, <<"Request">>]).
281   --define(OPTIONAL_CONFERENCE_ERROR_HEADERS, [<<"Msg-ID">>]).
  282 +-define(OPTIONAL_CONFERENCE_ERROR_HEADERS, []).
282 283 -define(CONFERENCE_ERROR_VALUES, [{<<"Event-Category">>, <<"conference">>}
283 284 ,{<<"Event-Name">>, <<"error">>}
284 285 ]).
8 lib/whistle-1.0.0/src/api/wapi_dialplan.hrl
@@ -421,13 +421,13 @@
421 421 %% IMPORTANT: to use the filter-applications list, Insert-At must be "now"
422 422
423 423 -define(NOOP_REQ_HEADERS, [<<"Application-Name">>, <<"Call-ID">>]).
424   --define(OPTIONAL_NOOP_REQ_HEADERS, [<<"Msg-ID">>, <<"Insert-At">>, <<"Filter-Applications">>]).
  424 +-define(OPTIONAL_NOOP_REQ_HEADERS, [<<"Insert-At">>, <<"Filter-Applications">>]).
425 425 -define(NOOP_REQ_VALUES, [{<<"Event-Category">>, <<"call">>}
426 426 ,{<<"Event-Name">>, <<"command">>}
427 427 ,{<<"Application-Name">>, <<"noop">>}
428 428 ,?INSERT_AT_TUPLE
429 429 ]).
430   --define(NOOP_REQ_TYPES, [{<<"Msg-ID">>, fun is_binary/1}]).
  430 +-define(NOOP_REQ_TYPES, []).
431 431
432 432 %% Conference
433 433 -define(CONFERENCE_REQ_HEADERS, [<<"Application-Name">>, <<"Call-ID">>, <<"Conference-ID">>]).
@@ -446,14 +446,14 @@
446 446
447 447 %% Originate Ready
448 448 -define(ORIGINATE_READY_HEADERS, [<<"Call-ID">>, <<"Control-Queue">>]).
449   --define(OPTIONAL_ORIGINATE_READY_HEADERS, [<<"Msg-ID">>]).
  449 +-define(OPTIONAL_ORIGINATE_READY_HEADERS, []).
450 450 -define(ORIGINATE_READY_VALUES, [{<<"Event-Category">>, <<"dialplan">>}
451 451 ,{<<"Event-Name">>, <<"originate_ready">>}
452 452 ]).
453 453 -define(ORIGINATE_READY_TYPES, []).
454 454
455 455 %% Originate Execute
456   --define(ORIGINATE_EXECUTE_HEADERS, [<<"Msg-ID">>, <<"Call-ID">>]).
  456 +-define(ORIGINATE_EXECUTE_HEADERS, [<<"Call-ID">>]).
457 457 -define(OPTIONAL_ORIGINATE_EXECUTE_HEADERS, []).
458 458 -define(ORIGINATE_EXECUTE_VALUES, [{<<"Event-Category">>, <<"dialplan">>}
459 459 ,{<<"Event-Name">>, <<"originate_execute">>}
4 lib/whistle-1.0.0/src/api/wapi_media.erl
@@ -21,7 +21,7 @@
21 21
22 22 %% Media Request - when streaming is needed
23 23 -define(MEDIA_REQ_HEADERS, [<<"Media-Name">>]).
24   --define(OPTIONAL_MEDIA_REQ_HEADERS, [<<"Stream-Type">>, <<"Call-ID">>, <<"Msg-ID">>
  24 +-define(OPTIONAL_MEDIA_REQ_HEADERS, [<<"Stream-Type">>, <<"Call-ID">>
25 25 %% TTS-related flags
26 26 ,<<"Voice">>, <<"Language">>, <<"Format">>
27 27 ,<<"Account-ID">>
@@ -36,7 +36,7 @@
36 36
37 37 %% Media Response
38 38 -define(MEDIA_RESP_HEADERS, [<<"Media-Name">>, <<"Stream-URL">>]).
39   --define(OPTIONAL_MEDIA_RESP_HEADERS, [<<"Msg-ID">>]).
  39 +-define(OPTIONAL_MEDIA_RESP_HEADERS, []).
40 40 -define(MEDIA_RESP_VALUES, [{<<"Event-Category">>, <<"media">>}
41 41 ,{<<"Event-Name">>, <<"media_resp">>}
42 42 ]).
7 lib/whistle-1.0.0/src/api/wapi_offnet_resource.erl
@@ -27,7 +27,7 @@
27 27 ,<<"Emergency-Caller-ID-Name">>, <<"Emergency-Caller-ID-Number">>
28 28 ,<<"Ringback">>, <<"SIP-Headers">>, <<"Custom-Channel-Vars">>
29 29 ,<<"Hold-Media">>, <<"Presence-ID">>, <<"Account-Realm">>
30   - ,<<"Control-Queue">>, <<"Call-ID">>, <<"Msg-ID">>, <<"Application-Data">>
  30 + ,<<"Control-Queue">>, <<"Call-ID">>, <<"Application-Data">>
31 31 ,<<"Account-ID">>
32 32 ]).
33 33 -define(OFFNET_RESOURCE_REQ_VALUES, [{<<"Event-Category">>, <<"resource">>}
@@ -47,8 +47,9 @@
47 47
48 48 %% Offnet Resource Response
49 49 -define(OFFNET_RESOURCE_RESP_HEADERS, [<<"Response-Message">>]).
50   --define(OPTIONAL_OFFNET_RESOURCE_RESP_HEADERS, [<<"Msg-ID">>, <<"Error-Message">>, <<"Response-Code">>
51   - ,<<"Call-ID">>, <<"Resource-Response">>]).
  50 +-define(OPTIONAL_OFFNET_RESOURCE_RESP_HEADERS, [<<"Error-Message">>, <<"Response-Code">>
  51 + ,<<"Call-ID">>, <<"Resource-Response">>
  52 + ]).
52 53 -define(OFFNET_RESOURCE_RESP_VALUES, [{<<"Event-Category">>, <<"resource">>}
53 54 ,{<<"Event-Name">>, <<"offnet_resp">>}
54 55 ]).
4 lib/whistle-1.0.0/src/api/wapi_rate.erl
@@ -22,7 +22,7 @@
22 22 %% AMQP fields for Rating Request
23 23 -define(RATE_REQ_HEADERS, [<<"To-DID">>, <<"Call-ID">>]).
24 24 -define(OPTIONAL_RATE_REQ_HEADERS, [<<"Call-ID">>, <<"Account-ID">>, <<"From-DID">>
25   - ,<<"Options">>, <<"Direction">>, <<"Msg-ID">>
  25 + ,<<"Options">>, <<"Direction">>
26 26 ]).
27 27 -define(RATE_REQ_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
28 28 ,{<<"Event-Name">>, <<"req">>}
@@ -36,7 +36,7 @@
36 36 -define(RATE_RESP_HEADERS, [<<"Rate">>, <<"Call-ID">>]).
37 37 -define(OPTIONAL_RATE_RESP_HEADERS, [<<"Rate-Increment">>, <<"Rate-Minimum">>
38 38 ,<<"Surcharge">>, <<"Base-Cost">>
39   - ,<<"Rate-Name">>, <<"Msg-ID">>
  39 + ,<<"Rate-Name">>
40 40 ]).
41 41 -define(RATE_RESP_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
42 42 ,{<<"Event-Name">>, <<"resp">>}
6 lib/whistle-1.0.0/src/api/wapi_registration.erl
@@ -39,7 +39,7 @@
39 39
40 40 %% Query Registrations
41 41 -define(REG_QUERY_HEADERS, [<<"Realm">>]).
42   --define(OPTIONAL_REG_QUERY_HEADERS, [<<"Username">>, <<"Fields">>, <<"Msg-ID">>]).
  42 +-define(OPTIONAL_REG_QUERY_HEADERS, [<<"Username">>, <<"Fields">>]).
43 43 -define(REG_QUERY_VALUES, [{<<"Event-Category">>, <<"directory">>}
44 44 ,{<<"Event-Name">>, <<"reg_query">>}
45 45 ]).
@@ -54,7 +54,7 @@
54 54
55 55 %% Registration Query Response
56 56 -define(REG_QUERY_RESP_HEADERS, [<<"Fields">>]).
57   --define(OPTIONAL_REG_QUERY_RESP_HEADERS, [<<"Multiple">>, <<"Msg-ID">>]).
  57 +-define(OPTIONAL_REG_QUERY_RESP_HEADERS, [<<"Multiple">>]).
58 58 -define(REG_QUERY_RESP_VALUES, [{<<"Event-Category">>, <<"directory">>}
59 59 ,{<<"Event-Name">>, <<"reg_query_resp">>}
60 60 ]).
@@ -62,7 +62,7 @@
62 62
63 63 %% Registration Query Error
64 64 -define(REG_QUERY_ERR_HEADERS, []).
65   --define(OPTIONAL_REG_QUERY_ERR_HEADERS, [<<"Msg-ID">>]).
  65 +-define(OPTIONAL_REG_QUERY_ERR_HEADERS, []).
66 66 -define(REG_QUERY_ERR_VALUES, [{<<"Event-Category">>, <<"directory">>}
67 67 ,{<<"Event-Name">>, <<"reg_query_error">>}
68 68 ]).
2  lib/whistle-1.0.0/src/api/wapi_resource.erl
@@ -22,7 +22,7 @@
22 22
23 23 -define(ORIGINATE_REQ_HEADERS, [<<"Endpoints">>, <<"Application-Name">>]).
24 24 -define(OPTIONAL_ORIGINATE_REQ_HEADERS, [<<"Application-Data">>, <<"Custom-Channel-Vars">>
25   - ,<<"Export-Custom-Channel-Vars">>, <<"Msg-ID">>
  25 + ,<<"Export-Custom-Channel-Vars">>
26 26 | fun() -> wapi_dialplan:optional_bridge_req_headers() end()
27 27 ]).
28 28 -define(ORIGINATE_REQ_VALUES, [{<<"Event-Category">>, <<"resource">>}
7 lib/whistle-1.0.0/src/api/wapi_route.erl
@@ -30,7 +30,7 @@
30 30 -define(ROUTE_REQ_EVENT_NAME, <<"route_req">>).
31 31
32 32 %% Route Requests
33   --define(ROUTE_REQ_HEADERS, [<<"Msg-ID">>, <<"To">>, <<"From">>, <<"Request">>, <<"Call-ID">>
  33 +-define(ROUTE_REQ_HEADERS, [<<"To">>, <<"From">>, <<"Request">>, <<"Call-ID">>
34 34 ,<<"Caller-ID-Name">>, <<"Caller-ID-Number">>
35 35 ]).
36 36 -define(OPTIONAL_ROUTE_REQ_HEADERS, [<<"Geo-Location">>, <<"Orig-IP">>, <<"Max-Call-Length">>, <<"Media">>
@@ -46,8 +46,7 @@
46 46 -define(ROUTE_REQ_COST_PARAMS, [<<"Min-Increment-Cost">>, <<"Max-Incremental-Cost">>
47 47 ,<<"Min-Setup-Cost">>, <<"Max-Setup-Cost">>
48 48 ]).
49   --define(ROUTE_REQ_TYPES, [{<<"Msg-ID">>, fun is_binary/1}
50   - ,{<<"To">>, fun is_binary/1}
  49 +-define(ROUTE_REQ_TYPES, [{<<"To">>, fun is_binary/1}
51 50 ,{<<"From">>, fun is_binary/1}
52 51 ,{<<"Request">>, fun is_binary/1}
53 52 ,{<<"Call-ID">>, fun is_binary/1}
@@ -86,7 +85,7 @@
86 85 ]).
87 86
88 87 %% Route Responses
89   --define(ROUTE_RESP_HEADERS, [<<"Msg-ID">>, <<"Method">>]).
  88 +-define(ROUTE_RESP_HEADERS, [<<"Method">>]).
90 89 -define(OPTIONAL_ROUTE_RESP_HEADERS, [<<"Custom-Channel-Vars">>, <<"Routes">>
91 90 ,<<"Route-Error-Code">>, <<"Route-Error-Message">>]).
92 91 -define(ROUTE_RESP_VALUES, [{<<"Event-Category">>, ?EVENT_CATEGORY}
10 lib/whistle-1.0.0/src/api/wapi_sysconf.erl
@@ -36,26 +36,26 @@
36 36 %% Configuration Document Update
37 37 %% request to read
38 38 -define(SYSCONF_GET_REQ_HEADERS, [<<"Category">>, <<"Key">>, <<"Node">>]).
39   --define(OPTIONAL_SYSCONF_GET_REQ_HEADERS, [<<"Default">>, <<"Msg-ID">>]).
  39 +-define(OPTIONAL_SYSCONF_GET_REQ_HEADERS, [<<"Default">>]).
40 40 -define(SYSCONF_GET_REQ_VALUES, [{<<"Event-Name">>, <<"get_req">>} | ?SYSCONF_VALUES]).
41 41
42 42 %% answer to a read request
43 43 -define(SYSCONF_GET_RESP_HEADERS, [<<"Category">>, <<"Key">>, <<"Value">>]).
44   --define(OPTIONAL_SYSCONF_GET_RESP_HEADERS, [<<"Node">>, <<"Msg-ID">>]).
  44 +-define(OPTIONAL_SYSCONF_GET_RESP_HEADERS, [<<"Node">>]).
45 45 -define(SYSCONF_GET_RESP_VALUES, [{<<"Event-Name">>, <<"get_resp">>} | ?SYSCONF_VALUES]).
46 46
47 47 %% request a write
48 48 -define(SYSCONF_SET_REQ_HEADERS, [<<"Category">>, <<"Key">>, <<"Value">>, <<"Node">>]).
49   --define(OPTIONAL_SYSCONF_SET_REQ_HEADERS, [<<"Msg-ID">>]).
  49 +-define(OPTIONAL_SYSCONF_SET_REQ_HEADERS, []).
50 50 -define(SYSCONF_SET_REQ_VALUES, [{<<"Event-Name">>, <<"set_req">>} | ?SYSCONF_VALUES]).
51 51
52 52 -define(SYSCONF_FLUSH_REQ_HEADERS, [<<"Category">>, <<"Key">>, <<"Node">>]).
53   --define(OPTIONAL_SYSCONF_FLUSH_REQ_HEADERS, [<<"Msg-ID">>]).
  53 +-define(OPTIONAL_SYSCONF_FLUSH_REQ_HEADERS, []).
54 54 -define(SYSCONF_FLUSH_REQ_VALUES, [{<<"Event-Name">>, <<"flush_req">>} | ?SYSCONF_VALUES]).
55 55
56 56 %% answer to a write request
57 57 -define(SYSCONF_SET_RESP_HEADERS, [<<"Category">>, <<"Key">>, <<"Value">>]).
58   --define(OPTIONAL_SYSCONF_SET_RESP_HEADERS, [<<"Node">>, <<"Status">>, <<"Msg-ID">>]).
  58 +-define(OPTIONAL_SYSCONF_SET_RESP_HEADERS, [<<"Node">>, <<"Status">>]).
59 59 -define(SYSCONF_SET_RESP_VALUES, [{<<"Event-Name">>, <<"set_resp">>} | ?SYSCONF_VALUES]).
60 60
61 61 -define(SYSCONF_TYPES, [{<<"Category">>, fun is_binary/1}
16 lib/whistle-1.0.0/src/wh_api.erl
@@ -241,7 +241,7 @@ build_message(Prop, ReqH, OptH) when is_list(Prop) ->
241 241 case defaults(Prop) of
242 242 {error, _Reason}=Error ->
243 243 lager:debug("API message does not have the default headers ~s: ~p"
244   - ,[string:join([wh_util:to_list(H) || H <- ReqH], ","), Error]),
  244 + ,[string:join([wh_util:to_list(H) || H <- ReqH], ","), Error]),
245 245 Error;
246 246 HeadAndProp ->
247 247 case build_message_specific_headers(HeadAndProp, ReqH, OptH) of
@@ -258,7 +258,7 @@ build_message_specific_headers({Headers, Prop}, ReqH, OptH) ->
258 258 case update_required_headers(Prop, ReqH, Headers) of
259 259 {error, _Reason} = Error ->
260 260 lager:debug("API message does not have the required headers ~s: ~p"
261   - ,[string:join([wh_util:to_list(H) || H <- ReqH], ","), Error]),
  261 + ,[string:join([wh_util:to_list(H) || H <- ReqH], ","), Error]),
262 262 Error;
263 263 {Headers1, Prop1} ->
264 264 {Headers2, _Prop2} = update_optional_headers(Prop1, OptH, Headers1),
@@ -275,7 +275,7 @@ build_message_specific({Headers, Prop}, ReqH, OptH) ->
275 275 case update_required_headers(Prop, ReqH, Headers) of
276 276 {error, _Reason} = Error ->
277 277 lager:debug("API message does not have the required headers ~s: ~p"
278   - ,[string:join([wh_util:to_list(H) || H <- ReqH], ","), Error]),
  278 + ,[string:join([wh_util:to_list(H) || H <- ReqH], ","), Error]),
279 279 Error;
280 280 {Headers1, Prop1} ->
281 281 {Headers2, _Prop2} = update_optional_headers(Prop1, OptH, Headers1),
@@ -376,7 +376,7 @@ values_check(Prop, Values) ->
376 376 true -> true;
377 377 false ->
378 378 lager:debug("API key '~s' value '~p' is not one of the values: ~p"
379   - ,[Key, V, Vs]),
  379 + ,[Key, V, Vs]),
380 380 false
381 381 end
382 382 end;
@@ -386,7 +386,7 @@ values_check(Prop, Values) ->
386 386 V -> true;
387 387 _Val ->
388 388 lager:debug("API key '~s' value '~p' is not '~p'"
389   - ,[Key, _Val, V]),
  389 + ,[Key, _Val, V]),
390 390 false
391 391 end
392 392 end, Values).
@@ -403,8 +403,8 @@ type_check(Prop, Types) ->
403 403 lager:debug("API key '~s' value '~p' failed validation fun", [Key, Value]),
404 404 false
405 405 end
406   - catch
407   - _:R ->
  406 + catch
  407 + _:R ->
408 408 lager:debug("API key '~s' value '~p' caused validation fun exception: ~p", [Key, Value, R]),
409 409 false
410 410 end
@@ -420,7 +420,7 @@ has_all_test() ->
420 420 Prop = [{<<"k1">>, <<"v1">>}
421 421 ,{<<"k2">>, <<"v2">>}
422 422 ,{<<"k3">>, <<"v3">>}
423   - ],
  423 + ],
424 424 Headers = [<<"k1">>, <<"k2">>, <<"k3">>],
425 425 ?assertEqual(true, has_all(Prop, Headers)),
426 426 ?assertEqual(false, has_all(Prop, [<<"k4">> | Headers])),
6 lib/whistle-1.0.0/src/wh_api.hrl
@@ -50,12 +50,15 @@
50 50 %% All messages MUST include the DEFAULT_HEADERS list.
51 51 -define(DEFAULT_HEADERS, [<<"Event-Category">>, <<"Event-Name">>
52 52 ,<<"App-Name">>, <<"App-Version">>
  53 + ,<<"Msg-ID">>
53 54 ]).
54 55 -define(OPTIONAL_DEFAULT_HEADERS, [<<"Raw-Headers">>, <<"Destination-Server">>
55 56 ,<<"Geo-Location">>, <<"Access-Group">>
56 57 ,<<"Tenant-ID">>, <<"Node">>, <<"Server-ID">>
57 58 ]).
58   --define(DEFAULT_VALUES, [{<<"Node">>, wh_util:to_binary(node())}]).
  59 +-define(DEFAULT_VALUES, [{<<"Node">>, wh_util:to_binary(node())}
  60 + ,{<<"Msg-ID">>, wh_util:rand_hex_binary(16)}
  61 + ]).
59 62 -define(DEFAULT_TYPES, [{<<"Server-ID">>, fun is_binary/1}
60 63 ,{<<"Event-Category">>, fun is_binary/1}
61 64 ,{<<"Event-Name">>, fun is_binary/1}
@@ -66,6 +69,7 @@
66 69 ,{<<"Geo-Location">>, fun is_binary/1}
67 70 ,{<<"Access-Group">>, fun is_binary/1}
68 71 ,{<<"Tenant-ID">>, fun is_binary/1}
  72 + ,{<<"Msg-ID">>, fun is_binary/1}
69 73 ]).
70 74
71 75 %% Error Responses
8 lib/whistle_amqp-1.0.0/src/wh_amqp_worker.erl
@@ -47,7 +47,7 @@
47 47 ,req_timeout_ref :: reference()
48 48 ,req_start_time :: wh_now()
49 49 ,callid :: ne_binary()
50   - ,pool_ref :: server_ref()
  50 + ,pool_ref :: server_ref()
51 51 }).
52 52
53 53 -define(FUDGE, 2600).
@@ -87,8 +87,8 @@ call(Srv, Req, PubFun, VFun) ->
87 87 call(Srv, Req, PubFun, VFun, Timeout) ->
88 88 case catch poolboy:checkout(Srv, false, 1000) of
89 89 W when is_pid(W) ->
90   - PoolName = pool_name_from_server_ref(Srv),
91   - wh_counter:dec(<<"amqp.pools.", PoolName/binary, ".available">>),
  90 + PoolName = pool_name_from_server_ref(Srv),
  91 + wh_counter:dec(<<"amqp.pools.", PoolName/binary, ".available">>),
92 92 Prop = case wh_json:is_json_object(Req) of
93 93 true -> wh_json:to_proplist(Req);
94 94 false -> Req
@@ -96,7 +96,7 @@ call(Srv, Req, PubFun, VFun, Timeout) ->
96 96 Q = gen_listener:queue_name(W),
97 97 Reply = gen_listener:call(W, {request, Prop, PubFun, VFun, Q, Timeout}, Timeout + ?FUDGE),
98 98 poolboy:checkin(Srv, W),
99   - wh_counter:inc(<<"amqp.pools.", PoolName/binary, ".available">>),
  99 + wh_counter:inc(<<"amqp.pools.", PoolName/binary, ".available">>),
100 100 Reply;
101 101 full ->
102 102 lager:debug("failed to checkout worker: full"),

0 comments on commit 392137c

Please sign in to comment.
Something went wrong with that request. Please try again.