SMPPEX.Pdu.Multipart.extract_from_pdu

You're seeing just the function extract_from_pdu, go back to SMPPEX.Pdu.Multipart module for more information.

Specs

extract_from_pdu(SMPPEX.Pdu.t()) :: extract_result()

Extracts multipart information from PDU.

Returns one of the following:

  • {:ok, :single, message} if the message does not contain any multipart information and represents a single message. The outcoming message is cleared from UDH bytes.
  • {:ok, {ref_num, count, seq_num}, message} if the original message contains multipart information in UDH fields. The outcoming message is cleared from UDH bytes.
  • {:error, reason}

Example

iex> pdu = Pdu.new({1,0,1}, %{esm_class: 0b01000000, short_message: <<0x05, 0x00, 0x03, 0x03, 0x02, 0x01, "message">>})
iex> SMPPEX.Pdu.Multipart.extract_from_pdu(pdu)
{:ok, {3,2,1}, "message"}

iex> pdu = Pdu.new({1,0,1}, %{short_message: <<0x05, 0x00, 0x03, 0x03, 0x02, 0x01, "message">>})
iex> SMPPEX.Pdu.Multipart.extract_from_pdu(pdu)
{:error, "Message is not multipart"}