47 std::string_view
mimeType, parameters;
48 auto sep = payload.first.find(
';');
49 if (std::string::npos ==
sep) {
52 mimeType = std::string_view(payload.first).substr(0,
sep);
53 parameters = std::string_view(payload.first).substr(
sep + 1);
58 if (std::string::npos ==
sep) {
70 if (
not parameters.size())
75 sep = parameters.find(
';');
98 if (std::string::npos !=
sep)
99 parameters = parameters.substr(
sep + 1);
100 }
while (std::string::npos !=
sep);
107 if (payloads.size() == 1) {
120 for (
const auto&
pair : payloads) {
123 JAMI_ERR(
"pjsip_multipart_create_part failed: not enough memory");
140 if (payloads.empty()) {
141 JAMI_WARN(
"The payloads argument is empty; ignoring message");
176static std::pair<std::string, std::string>
183 auto*
param = body->content_type.param.next;
184 while (
param != &body->content_type.param) {
190 return {std::move(
header), std::string(
static_cast<char*
>(body->data), (
size_t) body->len)};
201std::map<std::string, std::string>
204 std::map<std::string, std::string>
ret;
222 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...