on_incoming_subscribe property
Notification when incoming SUBSCRIBE request is received. Application may use this callback to authorize the incoming subscribe request (e.g. ask user permission if the request should be granted).
If this callback is not implemented, all incoming presence subscription requests will be accepted.
If this callback is implemented, application has several choices on what to do with the incoming request:
- it may reject the request immediately by specifying non-200 class final response in the \a code argument.
- it may immediately accept the request by specifying 200 as the \a code argument. This is the default value if application doesn't set any value to the \a code argument. In this case, the library will automatically send NOTIFY request upon returning from this callback.
- it may delay the processing of the request, for example to request user permission whether to accept or reject the request. In this case, the application MUST set the \a code argument to 202, then IMMEDIATELY calls #pjsua_pres_notify() with state PJSIP_EVSUB_STATE_PENDING and later calls #pjsua_pres_notify() again to accept or reject the subscription request.
Any \a code other than 200 and 202 will be treated as 200.
Application MUST return from this callback immediately (e.g. it must not block in this callback while waiting for user confirmation).
@param srv_pres Server presence subscription instance. If application delays the acceptance of the request, it will need to specify this object when calling #pjsua_pres_notify(). @param acc_id Account ID most appropriate for this request. @param buddy_id ID of the buddy matching the sender of the request, if any, or PJSUA_INVALID_ID if no matching buddy is found. @param from The From URI of the request. @param rdata The incoming request. @param code The status code to respond to the request. The default value is 200. Application may set this to other final status code to accept or reject the request. @param reason The reason phrase to respond to the request. @param msg_data If the application wants to send additional headers in the response, it can put it in this parameter.
Implementation
external ffi.Pointer<
ffi.NativeFunction<
ffi.Void Function(
pjsua_acc_id acc_id,
ffi.Pointer<pjsua_srv_pres> srv_pres,
pjsua_buddy_id buddy_id,
ffi.Pointer<pj_str_t> from,
ffi.Pointer<pjsip_rx_data> rdata,
ffi.Pointer<ffi.Int32> code,
ffi.Pointer<pj_str_t> reason,
ffi.Pointer<pjsua_msg_data> msg_data)>> on_incoming_subscribe;