-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highconnection handlers #116
Conversation
type moMsg struct { | ||
To string `name:"TO" validate:"required"` | ||
From string `name:"FROM" validate:"required"` | ||
Message string `name:"MESSAGE" validate:"required"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty SMS message exist, so probably don't want required on this.
// create our URN | ||
urn := urns.NewTelURNForCountry(hxRequest.From, channel.Country()) | ||
|
||
// build our infobipMessage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
} | ||
|
||
callbackDomain := msg.Channel().CallbackDomain(h.Server().Config().Domain) | ||
statusURL := fmt.Sprintf("https://%s%s%s/status", callbackDomain, "/c/hx/", msg.Channel().UUID()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a bit clearer to do https://%s/c/hx/%s/status
here.
msgURL, _ := url.Parse(sendURL) | ||
msgURL.RawQuery = form.Encode() | ||
|
||
req, err := http.NewRequest(http.MethodPost, msgURL.String(), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should either check error or assign it to _
return err | ||
} | ||
|
||
return s.AddHandlerRoute(h, http.MethodGet, "status", h.StatusMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From our logs it looks like status
is called with a GET
while receive is called with a POST
(and the parameters are in the body)
receiveURL = "/c/hx/8eb23e93-5ecb-45ba-b726-3b064e0c56ab/receive/" | ||
statusURL = "/c/hx/8eb23e93-5ecb-45ba-b726-3b064e0c56ab/status/" | ||
|
||
validReceive = receiveURL + "?FROM=+33610346460&TO=5151&MESSAGE=Hello+World&RECEPTION_DATE=2015-04-02T14:26:06" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be in the body for receive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sample:
ID=1499658874&FROM=%2B33627833699&TO=36105&MESSAGE=8&VALIDITY_DATE=2018-02-17T17%3A05%3A36&GET_STATUS=0&CLIENT=asdf&CLASS_TYPE=0&RECEPTION_DATE=2018-02-16T17%3A05%3A36&TO_OP_ID=20810&INITIAL_OP_ID=20810&STATUS=POSTING_13877_9612&EMAIL=&BINARY=0&PARAM=33609002133&USER_DATA=asdf&USER_DATA_2=8&BULK_ID=0&MO_ID=0&APPLICATION_ID=0&ACCOUNT_ID=asdf&GW_MESSAGE_ID=0&READ_STATUS=0&TARIFF=0&REQUEST_ID=33609002133&TAC=%28null%29&REASON=2018-02-16+18%3A05%3A36&FORMAT=&MVNO=&ORIG_ID=1499416284&ORIG_MESSAGE=s+sur+la+qualit%E9+de+l%27%E9change+que+vous+avez+eu+avec+votre+conseiller+Total+%3F+10%3D+Tout+%E0+fait+satisfait%2C+0%3D+Pas+du+tout+satisfait%2E+%28SMS+non+surtax%E9%29&RET_ID=30912965&ORIG_DATE=2018-02-16T15%3A35%3A52
|
||
var ( | ||
receiveURL = "/c/hx/8eb23e93-5ecb-45ba-b726-3b064e0c56ab/receive/" | ||
statusURL = "/c/hx/8eb23e93-5ecb-45ba-b726-3b064e0c56ab/status/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sample:
/handlers/hcnx/status/737ae87b-07b2-4b04-b805-9d1ff23fc873?push_id=1499658899&status=6&to=%2B33627833999&ret_id=30915369&text=O%F9+en+est+votre+demande+%E0+pr%E9sent%3F+1%3D+Trait%E9e+et+r%E9solue+pendant+cet+%E9change%2C+2%3D+Trait%E9e+et+en+cours+de+r%E9solution%2C+3%3D+Pas+trait%E9e+et+pas+r%E9solue%2E
Fix #106