# Extracting Call Traces with the API

The best resource is to use a `GET` method on `https://tmedia.com:12358/call_trace`

By default this will return the IDs of last `10` call legs. Unless you have set a different value in the same session.

&#x20;

To modify the number of results use the `nb_result` parameter.

Add Parameters using the following format:

`http://tmedia.com:12358/resource_url?parameter_a=1&parameter_b=2`

Like So:

`https://tmedia.com:12358/call_trace?nb_result=20`

&#x20;

To get full information on each leg add the parameter `recursive=yes`

`https://tmedia.com:12358/call_trace?nb_result=20&recursive=yes`

To get older information specify your page number, where 1 is the most recent calls.

`https://tmedia.com:12358/call_trace?page=2&recursive=yes&nb_result=20`

To get different information you can use different filters by adding them as parameters.

`https://tmedia.com:12358/call_trace?start=2025-03-03 00:00:00&end=2025-03-03 16:59:59&page=2&recursive=yes&terminate_reason=Not Normal&nb_result=20`

&#x20;

Available Parameters:

<table><thead><tr><th width="145.75006103515625">Parameter</th><th>Valid Input</th></tr></thead><tbody><tr><td>page</td><td>Integer (e.g., 1, 2, 3). Specifies the page number for paginated results. Defaults to 1 if omitted.</td></tr><tr><td>nb_result</td><td>Integer (e.g., 1 through 1000*). Sets the number of results per page. Omitting this paramter can cause problems.<br><br><em>*Limit of 1000 since 3.1.148+ 3.2.65+ 3.3.9+, older versions are limited to 100</em></td></tr><tr><td>start</td><td>DateTime string in YYYY-MM-DD HH:MM:SS format (e.g., 2025-03-03 00:00:00). Filters calls starting after this time. </td></tr><tr><td>end</td><td>DateTime string in YYYY-MM-DD HH:MM:SS format (e.g., 2025-03-03 23:59:59). Filters calls ending before this time. Omitting this paramter can cause problems.</td></tr><tr><td>called</td><td>String (e.g., 1234567890). The called phone number or SIP URI. Omit this parameter for no filter.</td></tr><tr><td>calling</td><td>String (e.g., 0987654321). The calling phone number or SIP URI. Omit this parameter for no filter.</td></tr><tr><td>nap</td><td>String (e.g., nap1). NAP Name. Omit this parameter for no filter.</td></tr><tr><td>route</td><td>String (e.g., routeA). Call route identifier. Omit this parameter for no filter.</td></tr><tr><td>protocol</td><td>String (e.g., SIP, SS7, CAS, or ISDN). Call protocol. Omit this parameter for no filter.</td></tr><tr><td>direction</td><td>Integer, 1 = Incoming, 2 = Outgoing, 3 = Mixer, or 4 = MediaOnly). Call direction. Empty string means no filter.</td></tr><tr><td>recorded</td><td>String (e.g., Recorded, Not Recorded). Indicates if the call was recorded . Empty string means no filter.</td></tr><tr><td>call_state</td><td>String (e.g., Active, Inactive). Call status. Empty string means no filter.</td></tr><tr><td>leg_id</td><td>String (e.g., 0x2D9E9DDE). Unique ID of a call leg. Empty string means no filter.</td></tr><tr><td>call_duration</td><td>String (e.g., 300). Call duration in seconds. Empty string means no filter.</td></tr><tr><td>terminate_reason</td><td>String (e.g., Normal, Not Normal, Manually Removed, or custom string: 206, 404 etc..).Empty string means no filter.</td></tr><tr><td>mos</td><td>String (e.g., 4.5). Mean Opinion Score (Float 0.0-5.0 for call quality). Empty string means no filter.</td></tr><tr><td>network_quality</td><td>Calls will be filtered based on a network quality equal to or less than that specified. Range from 1 to 100<br><br>Comparison operators can be used to modify the field behavior:<br>x : Will return all calls with a value greater than x<br>x-y : Will return all calls with a value between x and y<br>&#x3C;x : Will return all calls with a value less than x. Equivalent to 'x' alone</td></tr><tr><td>call_id</td><td>String (e.g., 54-1154254@172.31.36.128). Unique call identifier . Empty string means no filter.</td></tr><tr><td>intercepted</td><td>String (e.g., Intercepted, Not Intercepted, All). Indicates if the call was intercepted Empty string means no filter.</td></tr><tr><td>interception_liid</td><td>String (e.g., LIID123). Lawful Interception ID . Empty string means no filter.</td></tr><tr><td>interception_leg</td><td>String (e.g., 0= Not Interception Leg,1` = Interception Leg). Intercepted call leg identifier. Empty string means no filter.</td></tr></tbody></table>
