Restcomm 1512 - Extensions API changes needed for FAC#2757
Conversation
This close #RESTCOMM-1519
This close #RESTCOMM-1519
This close #RESTCOMM-1519
| * @return ExtensionResponse see ExtensionResponse | ||
| */ | ||
| ExtensionResponse preInboundAction(SipServletRequest request); | ||
| ExtensionResponse preInboundAction(IExtensionRequest extensionRequest); |
There was a problem hiding this comment.
i like the idea of being independent to underlying framework (servlet,akka), so good choice on having our own request. It would be still a good idea to be able to recover ref to original framework objects using generic container of objects, so extension impl may use them if required. I noticed in the "init" method we still inject a ServletContext, so the extension is still tied to specific ServletAPI. not sure if is time to have an specific ExtensionContext as well, and pass it as part of the request...
There was a problem hiding this comment.
ExtensionContext sounds a good idea @jaimecasero. Not sure also if its the proper time to do it.
I think that since now the team will be more familiar with the Extensions API, for the next task we can plan and estimate enhancements like the one you suggest
| } | ||
|
|
||
| public ExtensionResponse executePreInboundAction(final IExtensionRequest er, List<RestcommExtensionGeneric> extensions) { | ||
| ExtensionResponse response = new ExtensionResponse(); |
There was a problem hiding this comment.
what is the meaning of this default response?, how do we detect if this response is coming from an actual extension or not? maybe the empty response is good enough for the framework, just wondering...
There was a problem hiding this comment.
@jaimecasero The ExtensionResponse object will be set by each extension. The response holds an object that can be used to pass data from one extension back to RC, such as custom headers, custom proxy headers etc.
Currently, we don't use the post-*-action methods so we just create a response object and return it.
The idea for the post-*-action is to use them for maintenance and logistic, such as update logs, update db, notify services (charging) etc.....
| return response; | ||
| } | ||
|
|
||
| public ExtensionResponse executePostInboundAction(final IExtensionRequest er, List<RestcommExtensionGeneric> extensions) { |
There was a problem hiding this comment.
this extension API is starting to feel very specific ,with many variants of same purpose. Not sure if we could push all this executePre/PostXAction methods into the request interface, so the request tells the type of exec point X by a using a getter in the req interface... I think we could have a single pre and post methods...
There was a problem hiding this comment.
@jaimecasero we can discuss pros/cons about this for the next Extensions API enhancements
| ExtensionController ec = ExtensionController.getInstance(); | ||
| ApiRequest apiRequest = new ApiRequest(sid.toString(), data, ApiRequest.Type.CREATE_SUBACCOUNT); | ||
|
|
||
| if (executePostApiAction(apiRequest)) { |
There was a problem hiding this comment.
is this really post,or should be pre?
There was a problem hiding this comment.
@jaimecasero good catch, this must be pre. I will fix that
| call.tell(new Hangup(errMsg), source); | ||
| return; | ||
| } | ||
| ec.executePostOutboundAction(er, extensions); |
There was a problem hiding this comment.
should we delay the invocation of PostAction to when the ASR is actually executed?
There was a problem hiding this comment.
@jaimecasero, in general, the post action should be executed after the pre action.
At the point of your comment, the call is already answered and maybe had already executed some RCML verbs, the interpreter started executions of the gather verb with asr which account was not permitted and thus interpreter hangup the call. I think this is the proper place for post action method.
| final NotificationsDao notifications = storage.getNotificationsDao(); | ||
| final Notification notification = notification(WARNING_NOTIFICATION, 11001, "Outbound SMS is now allowed"); | ||
| notifications.addNotification(notification); | ||
| fsm.transition(message, finished); |
There was a problem hiding this comment.
are we covering postaction invocation later as part of FSM?
There was a problem hiding this comment.
@jaimecasero no, I missed the post action and I will add it now
| } | ||
| final NotificationsDao notifications = storage.getNotificationsDao(); | ||
| final Notification notification = notification(WARNING_NOTIFICATION, 11001, "Outbound SMS is now allowed"); | ||
| notifications.addNotification(notification); |
There was a problem hiding this comment.
are we covering postaction invocation as part of fsm lateR?
There was a problem hiding this comment.
@jaimecasero no, I missed the post action and I will add it now
| sendNotification(errMsg, 11001, "warning", true); | ||
| final SipServletResponse resp = request.createResponse(SC_FORBIDDEN, "Inbound USSD session is not Allowed"); | ||
| resp.send(); | ||
| ec.executePostOutboundAction(far, extensions); |
There was a problem hiding this comment.
are we invoking postAction here if feature isAllowed in the other branch?
There was a problem hiding this comment.
@jaimecasero we need to invoke post action in any case, I will fix that
| + " is not Allowed"; | ||
| sendNotification(errMsg, 11001, "warning", true); | ||
| final SipServletResponse resp = request.createResponse(SC_FORBIDDEN, "Call not allowed"); | ||
| resp.send(); |
There was a problem hiding this comment.
where do we cover postAction in this execution point (for both allowed and notAllowed options)?
There was a problem hiding this comment.
@jaimecasero I missed that, I will fix this
|
my comment on the topic is related to are same method and should have similar approach on applying a sequence of extensions to a given |
This refer to #RESTCOMM-1519
|
@maria-farooq @jaimecasero about your comments on improvements for Extensions API, I think those should definitely be discussed but are out of the scope of this feature and this sprint. Any changes in the API will have an impact on existing extensions. As I suggested earlier, we should record any suggestion, discuss them and in the next sprints plan them |
| @@ -0,0 +1,14 @@ | |||
| package org.restcomm.connect.extension.api; | |||
There was a problem hiding this comment.
Should we add copyright statement in begenning of this file?
| @@ -0,0 +1,79 @@ | |||
| package org.restcomm.connect.telephony.api; | |||
There was a problem hiding this comment.
shoudl we adde copyright statement in begening of this file
Changes needed to the Extensions API to support Feature Access Control feature