40 const std::pair<std::string, std::string>& payload,
48 std::string_view
mimeType, parameters;
49 auto sep = payload.first.find(
';');
50 if (std::string::npos ==
sep) {
53 mimeType = std::string_view(payload.first).substr(0,
sep);
54 parameters = std::string_view(payload.first).substr(
sep + 1);
59 if (std::string::npos ==
sep) {
71 if (
not parameters.size())
76 sep = parameters.find(
';');
99 if (std::string::npos !=
sep)
100 parameters = parameters.substr(
sep + 1);
101 }
while (std::string::npos !=
sep);
108 if (payloads.size() == 1) {
121 for (
const auto&
pair : payloads) {
124 JAMI_ERR(
"pjsip_multipart_create_part failed: not enough memory");
141 if (payloads.empty()) {
142 JAMI_WARN(
"The payloads argument is empty; ignoring message");
178static std::pair<std::string, std::string>
185 auto param = body->content_type.param.next;
186 while (
param != &body->content_type.param) {
192 return {std::move(header), std::string(
static_cast<char*
>(body->data), (
size_t) body->len)};
203std::map<std::string, std::string>
206 std::map<std::string, std::string>
ret;
224 while (
part !=
nullptr) {
#define JAMI_WARNING(formatstr,...)
void fillPJSIPMessageBody(pjsip_tx_data &tdata, const std::map< std::string, std::string > &payloads)
std::map< std::string, std::string > parseSipMessage(const pjsip_msg *msg)
Parses given SIP message into a map where the key is the contents of the Content-Type header (along w...
void sendSipMessage(pjsip_inv_session *session, const std::map< std::string, std::string > &payloads)
Constructs and sends a SIP message.
constexpr std::string_view MESSAGE
std::string sip_strerror(pj_status_t code)
constexpr std::string_view as_view(const pj_str_t &str) noexcept
constexpr const pj_str_t CONST_PJ_STR(T(&a)[N]) noexcept
static void createMessageBody(pj_pool_t *pool, const std::pair< std::string, std::string > &payload, pjsip_msg_body **body_p)
the pair<string, string> we receive is expected to be in the format <MIME type, payload> the MIME typ...
void emitSignal(Args... args)
static std::pair< std::string, std::string > parseMessageBody(const pjsip_msg_body *body)
Creates std::pair with the Content-Type header contents as the first value and the message payload as...