* Get display name from To header * param msg SIP message * param todisplay Display name of To header * param bufsize Size of todisplay buffer * return 0 success, -1 failure */
| 318 | * return 0 success, -1 failure |
| 319 | */ |
| 320 | int ospGetToDisplay( |
| 321 | struct sip_msg* msg, |
| 322 | char* todisplay, |
| 323 | int bufsize) |
| 324 | { |
| 325 | struct to_body* to; |
| 326 | int result = -1; |
| 327 | |
| 328 | if ((todisplay != NULL) && (bufsize > 0)) { |
| 329 | todisplay[0] = '\0'; |
| 330 | if (msg->to != NULL) { |
| 331 | if (parse_headers(msg, HDR_TO_F, 0) == 0) { |
| 332 | to = get_to(msg); |
| 333 | if ((to->display.s != NULL) && (to->display.len > 0)) { |
| 334 | ospCopyStrToBuffer(&to->display, todisplay, bufsize); |
| 335 | result = 0; |
| 336 | } |
| 337 | } else { |
| 338 | LM_ERR("failed to parse To header\n"); |
| 339 | } |
| 340 | } else { |
| 341 | LM_ERR("failed to find To header\n"); |
| 342 | } |
| 343 | } else { |
| 344 | LM_ERR("bad parameters to parse display name from To header\n"); |
| 345 | } |
| 346 | |
| 347 | return result; |
| 348 | } |
| 349 | |
| 350 | /* |
| 351 | * Get user part from To header |
no test coverage detected