> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # extractSipUsername > Static utility that extracts the username portion from a SIP URI in a request body. [ref-registerroutingcallback]: /docs/server-sdks/reference/typescript/agents/swml-service/register-routing-callback Static utility method that extracts the username portion from the `call.to` field of a parsed request body. Handles three input formats: * `sip:username@domain` (or `sips:...`) -- strips the scheme and `@domain` suffix, returning the username * `tel:+1234567890` -- strips the `tel:` scheme, returning the phone number * Plain string -- returned as-is Commonly paired with [`registerRoutingCallback()`][ref-registerroutingcallback] to route SIP traffic based on the dialed user. ## **Parameters** **`requestBody`** `Record` — required The parsed JSON body from an incoming request. Expected to contain a `call.to` field with a SIP URI, TEL URI, or phone number string. --- ## **Returns** `string | null` -- The extracted username or phone number, or `null` if the `call.to` field is missing or cannot be parsed. ## **Examples** ### Extract from SIP URI ```typescript {4} import { SWMLService } from '@signalwire/sdk'; const body = { call: { to: 'sip:sales@example.sip.signalwire.com' } }; const username = SWMLService.extractSipUsername(body); // "sales" ``` ### Extract from TEL URI ```typescript {4} import { SWMLService } from '@signalwire/sdk'; const body = { call: { to: 'tel:+15551234567' } }; const number = SWMLService.extractSipUsername(body); // "+15551234567" ``` > Static utility that extracts the username portion from a SIP URI in a request body.