Skip to content

Commit

Permalink
Merge pull request #698 from peter-oneill/remove-pcap-play-variable-f…
Browse files Browse the repository at this point in the history
…ilename

Remove support for variable PCAP filenames
  • Loading branch information
orgads committed Mar 22, 2024
2 parents 3cea6a7 + b33903f commit 5e57d81
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
BREAKING(!) changes in 3.7.3
============================

- Remove support for variables in PCAP filenames, originally introduced in 3.7.0~rc1. See #673

Bugs fixed in 3.7.3
===================

- Recovered `-mp` and `[auto_media_port]` to maintain backwards compatibility. (by Orgad Shaneh)
- Fix crash when using PCAP play with more than one call (by Pete O'Neill)

Bugs fixed in 3.7.2
===================
Expand Down
6 changes: 0 additions & 6 deletions src/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6076,12 +6076,6 @@ call::T_ActionResult call::executeAction(const char* msg, message* curmsg)
(currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) ||
(currentAction->getActionType() == CAction::E_AT_PLAY_DTMF)) {
play_args_t* play_args = 0;
if ((currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) ||
(currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_IMAGE) ||
(currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO)) {
const char *fileName = createSendingMessage(currentAction->getMessage());
currentAction->setPcapArgs(fileName);
}
if ((currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) ||
(currentAction->getActionType() == CAction::E_AT_PLAY_DTMF)) {
play_args = &(this->play_args_a);
Expand Down
28 changes: 23 additions & 5 deletions src/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ int sendMode = MODE_CLIENT;
/* This describes what our 3PCC behavior is. */
int thirdPartyMode = MODE_3PCC_NONE;

#define KEYWORD_SIZE 256

/*************** Helper functions for various types *****************/
long get_long(const char *ptr, const char *what)
{
Expand Down Expand Up @@ -239,6 +241,20 @@ double get_double(const char *ptr, const char *what)
static char* xp_get_keyword_value(const char *name)
{
const char* ptr = xp_get_value(name);
size_t len;
char keyword[KEYWORD_SIZE + 1];

if (ptr && ptr[0] == '[' && (len = strlen(ptr)) && ptr[len - 1] == ']') {
memcpy(keyword, ptr + 1, len - 2);

auto gen = generic.find(keyword);
if (gen != generic.end()) {
return strdup((*gen).second.c_str());
}

ERROR("%s \"%s\" looks like a keyword value, but keyword not supplied!", name, ptr);
}

return ptr ? strdup(ptr) : NULL;
}

Expand Down Expand Up @@ -1635,17 +1651,17 @@ void scenario::parseAction(CActions *actions)
tmpAction->setIntCmd(type);
#ifdef PCAPPLAY
} else if ((ptr = xp_get_keyword_value("play_pcap_audio"))) {
tmpAction->setMessage(ptr);
tmpAction->setPcapArgs(ptr);
tmpAction->setActionType(CAction::E_AT_PLAY_PCAP_AUDIO);
hasMedia = 1;
free(ptr);
} else if ((ptr = xp_get_keyword_value("play_pcap_image"))) {
tmpAction->setMessage(ptr);
tmpAction->setPcapArgs(ptr);
tmpAction->setActionType(CAction::E_AT_PLAY_PCAP_IMAGE);
hasMedia = 1;
free(ptr);
} else if ((ptr = xp_get_keyword_value("play_pcap_video"))) {
tmpAction->setMessage(ptr);
tmpAction->setPcapArgs(ptr);
tmpAction->setActionType(CAction::E_AT_PLAY_PCAP_VIDEO);
hasMedia = 1;
free(ptr);
Expand All @@ -1663,7 +1679,8 @@ void scenario::parseAction(CActions *actions)
} else if (xp_get_value("play_dtmf")) {
ERROR("Scenario specifies a play_dtmf action, but this version of SIPp does not have PCAP support");
#endif
} else if ((ptr = xp_get_keyword_value("rtp_stream"))) {
} else if ((cptr = xp_get_value("rtp_stream"))) {
ptr = strdup(cptr);
hasMedia = 1;
if (!strcmp(ptr, "pauseapattern"))
{
Expand Down Expand Up @@ -1705,7 +1722,8 @@ void scenario::parseAction(CActions *actions)
tmpAction->setActionType(CAction::E_AT_RTP_STREAM_PLAY);
}
free(ptr);
} else if ((ptr = xp_get_keyword_value("rtp_echo"))) {
} else if ((cptr = xp_get_value("rtp_echo"))) {
ptr = strdup(cptr);
hasMedia = 1;
if (!strncmp(ptr, "startaudio", 10))
{
Expand Down

0 comments on commit 5e57d81

Please sign in to comment.