Skip to content

Commit

Permalink
#167 Created constants for some Reason Codes fired by OF events.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrosa committed Jun 3, 2016
1 parent edebfdc commit 5a6d679
Showing 1 changed file with 18 additions and 15 deletions.
Expand Up @@ -61,6 +61,9 @@ public class PlayCollect extends Signal {
private final static Logger logger = Logger.getLogger(PlayCollect.class);

// MGCP Responses
private static final Text RC_300 = new Text("rc=300");
private static final Text RC_301 = new Text("rc=301");

private final Event oc;
private final Event of;

Expand Down Expand Up @@ -245,13 +248,13 @@ private void startPromptPhase(Collection<Text> promptList) {
// start playback
player.activate();
} catch (TooManyListenersException e) {
of.fire(this, new Text("rc=300"));
of.fire(this, RC_300);
logger.error("Too many listeners, firing of", e);
} catch (MalformedURLException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL in invalid format, firing of");
} catch (ResourceUnavailableException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL can not be found, firing of");
}
}
Expand Down Expand Up @@ -317,7 +320,7 @@ private void flushBuffer() {
}
dtmfDetector.flushBuffer();
} catch (TooManyListenersException e) {
of.fire(this, new Text("rc=300"));
of.fire(this, RC_300);
logger.error("Too many listeners for DTMF detector, firing of");
}
}
Expand Down Expand Up @@ -452,10 +455,10 @@ private void next(long delay) {
// start playback
player.start();
} catch (MalformedURLException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL in invalid format , firing of");
} catch (ResourceUnavailableException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL can not be found , firing of");
}
}
Expand Down Expand Up @@ -484,11 +487,11 @@ private void prev(long delay) {
// start playback
player.start();
} catch (MalformedURLException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL in invalid format, firing of");
return;
} catch (ResourceUnavailableException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL can not be found, firing of");
return;
}
Expand Down Expand Up @@ -517,10 +520,10 @@ private void curr(long delay) {
// start playback
player.start();
} catch (MalformedURLException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL in invalid format, firing of");
} catch (ResourceUnavailableException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL can not be found, firing of");
}
}
Expand Down Expand Up @@ -549,10 +552,10 @@ private void first(long delay) {
// start playback
player.start();
} catch (MalformedURLException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL in invalid format , firing of");
} catch (ResourceUnavailableException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL can not be found , firing of");
}
}
Expand Down Expand Up @@ -580,10 +583,10 @@ private void last(long delay) {
// start playback
player.start();
} catch (MalformedURLException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL in invalid format , firing of");
} catch (ResourceUnavailableException e) {
of.fire(this, new Text("rc=301"));
of.fire(this, RC_301);
logger.error("Received URL can not be found , firing of");
}
}
Expand Down Expand Up @@ -668,7 +671,7 @@ public void process(PlayerEvent event) {
}
break;
case PlayerEvent.FAILED:
of.fire(signal, new Text("rc=300"));
of.fire(signal, RC_300);
complete();
break;
}
Expand Down

0 comments on commit 5a6d679

Please sign in to comment.