| 742 | } |
| 743 | |
| 744 | dlg_t* rls_notify_dlg(subs_t* subs) |
| 745 | { |
| 746 | dlg_t* td=NULL; |
| 747 | |
| 748 | td= (dlg_t*)pkg_malloc(sizeof(dlg_t)); |
| 749 | if(td== NULL) |
| 750 | { |
| 751 | ERR_MEM(PKG_MEM_STR); |
| 752 | } |
| 753 | |
| 754 | memset(td, 0, sizeof(dlg_t)); |
| 755 | td->loc_seq.value = subs->local_cseq; |
| 756 | td->loc_seq.is_set = 1; |
| 757 | |
| 758 | td->id.call_id = subs->callid; |
| 759 | td->id.rem_tag = subs->from_tag; |
| 760 | td->id.loc_tag =subs->to_tag; |
| 761 | if(uandd_to_uri(subs->to_user, subs->to_domain, &td->loc_uri)< 0) |
| 762 | { |
| 763 | LM_ERR("while constructing uri from user and domain\n"); |
| 764 | goto error; |
| 765 | } |
| 766 | |
| 767 | if(uandd_to_uri(subs->from_user, subs->from_domain, &td->rem_uri)< 0) |
| 768 | { |
| 769 | LM_ERR("while constructing uri from user and domain\n"); |
| 770 | goto error; |
| 771 | } |
| 772 | |
| 773 | if(subs->contact.len ==0 || subs->contact.s == NULL ) |
| 774 | { |
| 775 | LM_DBG("BAD BAD contact NULL\n"); |
| 776 | td->rem_target = td->rem_uri; |
| 777 | } |
| 778 | else |
| 779 | td->rem_target = subs->contact; |
| 780 | |
| 781 | if(subs->record_route.s && subs->record_route.len) |
| 782 | { |
| 783 | if(parse_rr_body(subs->record_route.s, subs->record_route.len, |
| 784 | &td->route_set)< 0) |
| 785 | { |
| 786 | LM_ERR("in function parse_rr_body\n"); |
| 787 | goto error; |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | td->state= DLG_CONFIRMED ; |
| 792 | td->send_sock = subs->sockinfo; |
| 793 | |
| 794 | return td; |
| 795 | |
| 796 | error: |
| 797 | if(td) |
| 798 | { |
| 799 | if(td->loc_uri.s) |
| 800 | pkg_free(td->loc_uri.s); |
| 801 |
no test coverage detected