| 4826 | } |
| 4827 | |
| 4828 | static int w_rtpproxy_recording(struct sip_msg *msg, str *callid, |
| 4829 | str *from_tag, str *to_tag, struct rtpp_node *node, |
| 4830 | pv_spec_p var, str *flags, str *destination, int medianum) |
| 4831 | { |
| 4832 | int nitems; |
| 4833 | char cmd; |
| 4834 | int media_start, media_stop; |
| 4835 | sdp_info_t *msg_sdp; |
| 4836 | sdp_session_cell_t *msg_session; |
| 4837 | struct rtpproxy_vcmd vrec; |
| 4838 | |
| 4839 | RTPP_VCMD_INIT(vrec, 14, |
| 4840 | {&cmd, 1}, /*.vu[0] command R or C */ |
| 4841 | {NULL, 0}, /*.vu[1] flags, if they exist */ |
| 4842 | {" ", 1}, /*.vu[2] separator */ |
| 4843 | {NULL, 0}, /*.vu[3] callid */ |
| 4844 | {" ", 1}, /*.vu[4] separator */ |
| 4845 | {" ", 0}, /*.vu[5] recording destination, if specified */ |
| 4846 | {" ", 1}, /*.vu[6] separator */ |
| 4847 | {NULL, 0}, /*.vu[7] from_tag */ |
| 4848 | {";", 1}, /*.vu[8] medianum separator */ |
| 4849 | {NULL, 0}, /*.vu[9] medianum */ |
| 4850 | {" ", 1}, /*.vu[10] separator */ |
| 4851 | {NULL, 0}, /*.vu[11] to_tag */ |
| 4852 | {";", 1}, /*.vu[12] medianum separator */ |
| 4853 | {NULL, 0} /*.vu[13] medianum */ |
| 4854 | ); |
| 4855 | |
| 4856 | /* check if we support recording */ |
| 4857 | if (!HAS_CAP(node, RECORD)) { |
| 4858 | LM_ERR("RTPProxy does not support recording!\n"); |
| 4859 | goto error; |
| 4860 | } |
| 4861 | |
| 4862 | media_start = media_stop = 0; |
| 4863 | |
| 4864 | if (destination) { |
| 4865 | /* if name is specified, we need to change the command */ |
| 4866 | cmd = 'C'; |
| 4867 | STR2IOVEC(*destination, vrec.vu[5]); |
| 4868 | nitems = vrec.useritems; |
| 4869 | if (medianum > 0) |
| 4870 | media_start = media_stop = medianum; |
| 4871 | else if (!msg) |
| 4872 | media_start = media_stop = 1; |
| 4873 | else { |
| 4874 | /* |
| 4875 | * we need to parse the message, if it exists, and count the |
| 4876 | * number of sessions it has |
| 4877 | */ |
| 4878 | media_start = 1; |
| 4879 | media_stop = 0; |
| 4880 | msg_sdp = parse_sdp(msg); |
| 4881 | if (msg_sdp) { |
| 4882 | for (msg_session = msg_sdp->sessions; msg_session; |
| 4883 | msg_session = msg_session->next) |
| 4884 | media_stop += msg_session->streams_num; |
| 4885 | } else { |
no test coverage detected