# Responding to Modem Service Requests - [When to Use](#section273mcpsimp) - [Available APIs](#section276mcpsimp) - [How to Develop](#section532835815524) - [\(Optional\) Commissioning and Verification](#section332mcpsimp) ## When to Use After receiving a specific telephony service request, the RIL Adapter calls the target function pointer obtained in modem vendor library initialization to send a specific service request to the vendor library. Then the vendor library processes the request based on the request ID. ## Available APIs The following table describes the APIs for responding to modem service requests. **Table 1** APIs for responding to modem service requests

API

Description

static void

OnRequest(int request, void *data, size_t datalen, RIL_Token t)

Distributes service requests.

void OnRequestResponse(RIL_Token t, RIL_Errno e, void *response, size_t responselen);

Reports the execution result of a service request to RIL Adapter.

## How to Develop 1. Distribute service requests based on request IDs through **OnRequest\(\)**. ``` switch (request) { case HREQ_CALL_DIAL: SendDialRequest(data, datalen, t); break; case HREQ_CALL_HANGUP: SendHangupRequest(data, datalen, t); break; ... default: break; } ``` 2. After a modem executes a service request, call **OnRequestResponse\(\)** to report the target event to RIL Adapter. ``` asprintf(&cmd, "ATD%s%s;", dial->address, clir); ret = send_at_request(cmd, NULL); free(cmd); OnRequestResponse(t, RIL_RESULT_SUCCESS, NULL, 0); ``` ## \(Optional\) Commissioning and Verification 1. Use the **HDC** tool to connect to a commissioning device, and run the **hdc file send** command to send the generated **libvendor.z.so** library file to the **/system/lib/** directory. 2. Run the **hdc shell sync** and **hdc shell reboot** commands to restart the device. 3. Run the **hdc shell hilog** command to check whether **OnRequest\(\)** is successfully executed based on the log information.